Doc #78699 [NEW]: shell_exec on windows runs in text mode, this should be noted in the docs.
| From: | phpstuff at cresstone dot com | Date: | Sun, 20 Oct 2019 05:35:07 +0000 |
| Subject: | Doc #78699 [NEW]: shell_exec on windows runs in text mode, this should be noted in the docs. | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17023@lists.php.net to get a copy of this message | ||
From: phpstuff at cresstone dot com
Operating system: Windows
PHP version: 7.3.10
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:shell_exec on windows runs in text mode, this should be noted in the docs.
Description:
------------
---
From manual page: https://php.net/function.shell-exec
---
On windows, shell_exe() & the backtick operator operate in text mode.
When I was trying to get binary stdout from a command I encountered
incorrect output, and the command I was running gave âbroken pipeâ
messages on its stderr. Any binary output that includes newlines seem to
cause errors.
The documentation doesnât mention this, and took me a while to puzzle
out what was happening.
The work-around is to use popen() with the binary flag:
$handle = popen('someCommand.exe', 'rb');
$binarySTDOUT = stream_get_contents($handle);
pclose($handle);
I wasnât sure whether to file this as a language bug or just add a
comment on the documentation, this report seemed like a good
compromise...
--
Edit bug report at https://bugs.php.net/bug.php?id=78699&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78699&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78699&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78699&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78699&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78699&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78699&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78699&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78699&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78699&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78699&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78699&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78699&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78699&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78699&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78699&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78699&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78699&r=mysqlcfg