Doc #65925 [NEW]: Incorrect return value for shell_exec(), backticks

From: Date: Fri, 18 Oct 2013 00:36:25 +0000
Subject: Doc #65925 [NEW]: Incorrect return value for shell_exec(), backticks
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10506@lists.php.net to get a copy of this message
From: krewecherl at gmail dot com Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Incorrect return value for shell_exec(), backticks Description: ------------ The page at http://www.php.net/manual/en/function.shell-exec.php reads: Return Values The output from the executed command or NULL if an error occurred. This is incorrect, as some of the commenters have noted. Successfully executed commands (exit status 0) that produce no output also return NULL. The return value is documented to be a string, so we would expect an empty string in the case of no output. I would even argue that this is a bug, because it prevents detecting a non-zero exit status, but changing the behavior at this late stage would probably do more damage than good. In any case, it needs to be properly documented. Test script: --------------- $ php -r 'system("sync", $status); var_dump($status);' int(0) $ php -r '$rv = shell_exec("sync"); var_dump($rv);' NULL $ php -r '$rv = sync; var_dump($rv);' NULL -- Edit bug report at https://bugs.php.net/bug.php?id=65925&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65925&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=65925&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65925&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65925&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65925&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65925&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65925&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65925&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65925&r=support Expected behavior: https://bugs.php.net/fix.php?id=65925&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65925&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65925&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65925&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65925&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65925&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65925&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65925&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65925&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65925&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65925&r=mysqlcfg

« previous php.doc.bugs (#10506) next »