|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-04-06 11:30 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-04-06 11:30 UTC] cmb@php.net
[2021-04-18 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
Description: ------------ I have the same issue under FreeBSD 10 with php-5.5.14 as #50524 but only with proc_open(). Under Linux I got the expected result. Test script: --------------- <?php chdir('/home/webadmin/test'); $fdSpecs = array( 1 => array('pipe', 'w'), 2 => array('pipe', 'w'), ); $process = proc_open('php -r "var_dump(getcwd());"', $fdSpecs, $pipes); echo 'Without $cwd argument:', PHP_EOL; echo stream_get_contents($pipes[1]); echo PHP_EOL; $process = proc_open('php -r "var_dump(getcwd());"', $fdSpecs, $pipes, NULL); echo 'With NULL as $cwd argument:', PHP_EOL; echo stream_get_contents($pipes[1]); echo PHP_EOL; $process = proc_open('php -r "var_dump(getcwd());"', $fdSpecs, $pipes, getcwd()); echo 'With getcwd() as $cwd argument:', PHP_EOL; echo stream_get_contents($pipes[1]); echo PHP_EOL; $process = proc_open('php -r "var_dump(getcwd());"', $fdSpecs, $pipes, '/'); echo 'With "/" as $cwd argument:', PHP_EOL; echo stream_get_contents($pipes[1]); echo PHP_EOL; echo 'Exec $CWD: ', PHP_EOL; echo exec('php -r "var_dump(getcwd());"'), PHP_EOL; ?> Expected result: ---------------- Without $cwd argument: string(14) "/home/webadmin/test" With NULL as $cwd argument: string(14) "/home/webadmin/test" With getcwd() as $cwd argument: string(19) "/home/webadmin/test" With "/" as $cwd argument: string(1) "/" Exec $CWD: string(19) "/home/webadmin/test" Actual result: -------------- Without $cwd argument: string(14) "/home/webadmin" With NULL as $cwd argument: string(14) "/home/webadmin" With getcwd() as $cwd argument: string(19) "/home/webadmin/test" With "/" as $cwd argument: string(1) "/" Exec $CWD: string(19) "/home/webadmin/test"