Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Oct 29, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

@alexandre-daubois
Copy link
Member

alexandre-daubois commented Oct 30, 2024

What about:

diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
index a1b8d6d54b..5052fc0d6b 100644
--- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
+++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php
@@ -138,6 +138,21 @@ class ExecutableFinderTest extends TestCase
         $this->assertSamePath($target.'.BAT', $result);
     }
 
+    public function testEmptyDirInPath()
+    {
+        putenv(sprintf('PATH=%s:', \dirname(\PHP_BINARY)));
+
+        touch('executable');
+        chmod('executable', 0700);
+
+        $finder = new ExecutableFinder();
+        $result = $finder->find('executable');
+
+        $this->assertSame('./executable', $result);
+
+        unlink('executable');
+    }
+
     private function assertSamePath($expected, $tested)
     {
         if ('\\' === \DIRECTORY_SEPARATOR) {

The result before your fix:

/Users/.../PhpstormProjects/symfony/./executable

After this fix:

./executable

@nicolas-grekas
Copy link
Member Author

Perfect thanks! PR updated.

@nicolas-grekas nicolas-grekas merged commit 44ce9fa into symfony:5.4 Oct 31, 2024
11 of 12 checks passed
@nicolas-grekas nicolas-grekas deleted the process-fix-empty branch October 31, 2024 07:36
nicolas-grekas added a commit that referenced this pull request Nov 4, 2024
…y` block (alexandre-daubois)

This PR was merged into the 5.4 branch.

Discussion
----------

[Process] Improve test cleanup by unlinking in a `finally` block

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Follwup for #58711, I realized afterwards that we may unlink in `finally` block to ensure proper test clean up in case something goes wrong.

Commits
-------

5c547c9 [Process] Improve test cleanup by unlinking in a `finally` block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants