Bug #68977 [Opn]: Regression with linebreaks returned from exec()
| From: | yunosh@php.net | Date: | Tue, 03 Feb 2015 11:55:19 +0000 |
| Subject: | Bug #68977 [Opn]: Regression with linebreaks returned from exec() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190440@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68977&edit=1
ID: 68977
Updated by: yunosh@php.net
Reported by: yunosh@php.net
Summary: Regression with linebreaks returned from exec()
Status: Open
Type: Bug
Package: Program Execution
Operating System: Linux
PHP Version: 5.4Git-2015-02-03 (Git)
Block user comment: N
Private report: N
New Comment:
I tried with 5.6 from rasmus' vagrant box, and the bug wasn't there.
Previous Comments:
------------------------------------------------------------------------
[2015-02-03 10:52:49] yohgaki@php.net
I think I've seen the same issue for release version.
It would be nicer add this to the bug report.
------------------------------------------------------------------------
[2015-02-03 10:36:37] yunosh@php.net
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 this bug report at https://bugs.php.net/bug.php?id=68977&edit=1