ID: 41874
User updated by: ckeefer at us dot nomura dot com
Reported By: ckeefer at us dot nomura dot com
-Status: Feedback
+Status: Open
Bug Type: Unknown/Other Function
Operating System: Windows XP Pro SP2
PHP Version: 5.2.3
New Comment:
Thank you for the quick response. The new version still shows no
STDERR output from a cmd.exe window.
Thanks
C:\php5.2fix>php test_exec.php
Two exec statements:
-------------------
This exec should result in error for non-existant dir:
Array
(
)
-----------------------
This exec works:
--------------------
Array
(
[0] => Volume in drive C is LOCAL DISK
[1] => Volume Serial Number is 4054-8345
[2] =>
[3] => Directory of C:\php5.2fix
[4] =>
[5] => 07/03/2007 08:08 AM 32,821 php.exe
[6] => 1 File(s) 32,821 bytes
[7] => 0 Dir(s) 58,549,849,088 bytes free
)
C:\php5.2fix>
C:\php5.2fix>type test_exec.php
<?php
echo "Two exec statements:\n-------------------\n";
echo "This exec should result in error for non-existant dir:\n";
exec("cd c:\\non_existant", $err);
print_r($err);
echo "-----------------------\n";
echo "This exec works:\n--------------------\n";
exec("dir php.exe", $ary);
print_r($ary);
?>
Previous Comments:
------------------------------------------------------------------------
[2007-07-03 06:41:22] [EMAIL PROTECTED]
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2007-07-02 18:39:25] ckeefer at us dot nomura dot com
Description:
------------
PHP CLI version 5.1.8 thru 5.2.1 Windows Binary - exec() function, when
error is generated passes STDERR no problem to CLI window. 5.2.2+
STDERR output has vanished. Nothing in documentation or search suggests
what happened. No other changes 5.2.1 just downloaded and tested with
generic setup (no php.ini or other modifications) stderr from exec()
functions perfectly. 5.2.2+ system() apparently passes stderr properly,
but is not useful for most of what we do. STDOUT appears to be fine all
versions.
Oddly, 5.2.2+ versions still work correctly with cygwin/bash 3.1
Note in 5.2.2 changelog contains this bit:
- Fixed commandline handling for CLI and CGI. (Marcus, Johannes)
Thanks,
Chip Keefer
Reproduce code:
---------------
<?php
$result = exec('cd c:\non_existant; dir nonexistant');
echo "$result\n";
?>
Expected result:
----------------
NJPC3916:php5.22$ php test_exec.php
php test_exec.php
The system cannot find the path specified.
- Works properly with cygwin
Actual result:
--------------
C:\php5.22>php test_exec.php
C:\php5.22>
No STDERR
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41874&edit=1