From:             seld
Operating system: Windows 7 x64
PHP version:      5.5.0alpha1
Package:          Program Execution
Bug Type:         Bug
Bug description:exec() always yields a 1 return code

Description:
------------
Running exec() seems to detect a non-zero (and specifically 1) return
code/exit code for the process. No matter what process. It also affects the
proc_open class of functions so there is not even a decent workaround as
far as we know.

Works on my machine but @johmue on github has the issue consistently. He
tried with all latest 5.2, 5.3 and 5.4, even 5.5-alpha1. They all do the
same. Yet on my machine 5.4.8 works fine. At first sight I have exactly the
same OS and PHP build that he does, so this makes no sense to me. There
must be something wrong in his environment but we are not able to figure
out what causes it.

Note that trying the same thing in the shell directly yields a correct
result, so the issue seems to be in php, for example this works:

C:\>dir
[snip]
C:\>echo %errorlevel%
0

You can find the full thread below, but I tried to sum it up above:

https://github.com/composer/composer/issues/613

Test script:
---------------
C:\>php -r "exec('dir', $out, $ret);var_dump($ret);"


Expected result:
----------------
int(0)


Actual result:
--------------
Die Syntax für den Dateinamen, Verzeichnisnamen oder die
Datenträgerbezeichnung
ist falsch.
int(1)


----

Interstingly, it does output the wrong return code, and also prints this
warning saying that the syntax of the filename/command is wrong.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63567&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63567&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63567&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63567&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63567&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63567&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63567&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63567&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63567&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63567&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63567&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63567&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63567&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63567&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63567&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63567&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63567&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63567&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63567&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63567&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63567&r=mysqlcfg

Reply via email to