Bug #67552 [Fbk->NoF]: proc_open is using a wrong initial working dir
| From: | php-bugs at lists dot php dot net | Date: | Sun, 18 Apr 2021 04:22:09 +0000 |
| Subject: | Bug #67552 [Fbk->NoF]: proc_open is using a wrong initial working dir | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233481@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67552&edit=1
ID: 67552
Updated by: php-bugs@lists.php.net
Reported by: iron at mail dot ua
Summary: proc_open is using a wrong initial working dir
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Program Execution
Operating System: FreeBSD
PHP Version: 5.5.14
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-04-06 11:30:29] cmb@php.net
Did you use a thread-safe (ZTS) PHP build? In this case the
behavior is expected since the CWD is virtual and not really set
for the OS.
------------------------------------------------------------------------
[2014-07-02 08:47:45] iron at mail dot ua
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"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67552&edit=1