|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-02-15 17:33 UTC] ab@php.net
-Status: Open
+Status: Not a bug
[2017-02-15 17:33 UTC] ab@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 04:00:01 2025 UTC |
Description: ------------ I use iis7.0 && php5.6.30(I also test in apache+php, the result is same) to run following php code ``` <?php $cmd = "error_command || whoami"; exec($cmd, $output, $return_val); var_dump($output); var_dump($return_val); ?> ``` If the first command is wrong, then the second command wouldn't be executed, the output is ``` array(0) { } int(1) ``` But I run the code on windows+built-in webserver, the output is ``` array(1) { [0]=> string(12) "71ec\phithon" } int(0) ``` Cli's result: ``` F:\PHPStudy\WWW>F:\soft\php-5.6.30-Win32-VC11-x86\php.exe test\a.php 'error_command' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 array(1) { [0]=> string(12) "71ec\phithon" } int(0) ``` So why php has 2 different results? Test script: --------------- <?php $cmd = "error_command || whoami"; exec($cmd, $output, $return_val); var_dump($output); var_dump($return_val); ?> Expected result: ---------------- array(1) { [0]=> string(12) "71ec\phithon" } int(0) Actual result: -------------- array(0) { } int(1)