Bug #74074 [NEW]: "||" is not useful on windows's program execution function.
| From: | phith0n dot ph2f at gmail dot com | Date: | Fri, 10 Feb 2017 11:15:00 +0000 |
| Subject: | Bug #74074 [NEW]: "||" is not useful on windows's program execution function. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207245@lists.php.net to get a copy of this message | ||
From: phith0n dot ph2f at gmail dot com
Operating system: Windows
PHP version: 5.6.30
Package: Program Execution
Bug Type: Bug
Bug description:"||" is not useful on windows's program execution function.
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)
--
Edit bug report at https://bugs.php.net/bug.php?id=74074&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74074&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74074&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74074&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74074&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74074&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74074&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74074&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74074&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74074&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74074&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74074&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74074&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74074&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74074&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74074&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74074&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74074&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74074&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74074&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74074&r=mysqlcfg