Bug #68977 [NEW]: Regression with linebreaks returned from exec()
| From: | yunosh@php.net | Date: | Tue, 03 Feb 2015 10:36:38 +0000 |
| Subject: | Bug #68977 [NEW]: Regression with linebreaks returned from exec() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-190438@lists.php.net to get a copy of this message | ||
From: yunosh
Operating system: Linux
PHP version: 5.4Git-2015-02-03 (Git)
Package: Program Execution
Bug Type: Bug
Bug description:Regression with linebreaks returned from exec()
Description:
------------
exec() doesn't return empty lines from execution results as empty
strings, but as newline characters.
Test script:
---------------
cmd.php:
#!/usr/bin/env php
Line one
Line two
Line three
Line four
test.php:
<?php
exec(__DIR__ . '/cmd.php', $result, $value);
var_dump($result);
Expected result:
----------------
array(5) {
[0]=>
string(8) "Line one"
[1]=>
string(8) "Line two"
[2]=>
string(0) ""
[3]=>
string(10) "Line three"
[4]=>
string(9) "Line four"
}
Actual result:
--------------
array(5) {
[0]=>
string(8) "Line one"
[1]=>
string(8) "Line two"
[2]=>
string(1) "
"
[3]=>
string(10) "Line three"
[4]=>
string(9) "Line four"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=68977&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68977&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68977&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68977&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68977&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68977&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68977&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68977&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68977&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68977&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68977&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68977&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68977&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68977&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68977&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68977&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68977&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68977&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68977&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68977&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68977&r=mysqlcfg