Bug #70018 [Opn]: exec does not strip all whitespace
| From: | robbert at muze dot nl | Date: | Wed, 08 Jul 2015 08:20:57 +0000 |
| Subject: | Bug #70018 [Opn]: exec does not strip all whitespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194202@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70018&edit=1
ID: 70018
User updated by: robbert at muze dot nl
Reported by: robbert at muze dot nl
Summary: exec does not strip all whitespace
Status: Open
Type: Bug
Package: Program Execution
Operating System: Debian jessie
PHP Version: master-Git-2015-07-08 (Git)
Block user comment: N
Private report: N
New Comment:
forgot to add, the expected output is from the following php version
PHP 5.6.9-1 (cli) (built: May 22 2015 10:48:57)
Previous Comments:
------------------------------------------------------------------------
[2015-07-08 08:17:45] robbert at muze dot nl
Description:
------------
exec does not remove the first char in a line of output, if it is whitespace
if the line only contains " \n" the " " isn't striped
Test script:
---------------
<?php
$output = array();
exec('/bin/echo -n -e "abc\f\n \n"',$output);
var_dump($output);
Expected result:
----------------
array(2) {
[0]=>
string(3) "abc"
[1]=>
string(0) ""
}
Actual result:
--------------
array(2) {
[0]=>
string(3) "abc"
[1]=>
string(1) " "
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70018&edit=1