Skip to content

Commit 06e6c10

Browse files
committed
merged branch Seldaek/regressionfix (PR #7102)
This PR was merged into the 2.0 branch. Commits ------- 179cd58 [Process] Fix regression introduced in #6620 / 880da01, fixes #7082 Discussion ---------- [Process][2.0] getcwd failure fix Fix regression introduced in #6620 Fixes #7082 For reference, here is the current behavior I saw: PHP 5.4.11, windows: ``` 5.4.11\php.exe -r "chdir('c:\\'); var_dump(getcwd()); $p = proc_open('pwd', [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes, null); var_dump(stream_get_contents($pipes[1]));" string(3) "C:\\" string(14) "/c/Users/seld\n" ``` (I use pwd which is a unix util so it dumps a funny path, but don't look at that) PHP 5.5alpha4, windows (seems fixed): ``` 5.5.0a4\php.exe -r "chdir('c:\\'); var_dump(getcwd()); $p = proc_open('pwd', [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']], $pipes, null); var_dump(stream_get_contents($pipes[1]));" string(3) "C:\" string(3) "/c\n" ``` PHP 5.3.10, ubuntu: ``` php -r "chdir('/'); var_dump(getcwd()); \$p = proc_open('pwd', array(array('pipe', 'r'), array('p ipe', 'w'), array('pipe', 'w')), \$pipes, null); var_dump(stream_get_contents(\$pipes[1]));" string(1) "/" string(2) "/\n" ``` Since the permission issue that #6620 originally was fixing is most likely not gonna happen on windows, this seems like a safe enough compromise. Ideally a check for PHP<5.5 should be introduced, but I would like to be sure it's been fixed and is not just a lucky coincidence (/cc @pierrejoye) I would recommend merging fast and maybe adding the version check later, since it breaks composer create-project on windows. The workaround being: cd in the dir and run `composer install` again to finalize the project setup. --------------------------------------------------------------------------- by vicb at 2013-02-17T20:12:17Z Thanks @Seldaek ! Would you mind creating an issue for the version check so that it doesn't get lost ? --------------------------------------------------------------------------- by Seldaek at 2013-02-18T10:43:56Z @vicb done. --------------------------------------------------------------------------- by vicb at 2013-02-18T11:45:16Z thanks !
2 parents d41fc8b + 179cd58 commit 06e6c10

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public function __construct($commandline, $cwd = null, array $env = null, $stdin
5454

5555
$this->commandline = $commandline;
5656
$this->cwd = $cwd;
57+
// on windows, if the cwd changed via chdir(), proc_open defaults to the dir where php was started
58+
if (null === $this->cwd && defined('PHP_WINDOWS_VERSION_BUILD')) {
59+
$this->cwd = getcwd();
60+
}
5761
if (null !== $env) {
5862
$this->env = array();
5963
foreach ($env as $key => $value) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy