php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70018 exec does not strip all whitespace
Submitted: 2015-07-08 08:17 UTC Modified: 2015-07-08 08:20 UTC
From: robbert at muze dot nl Assigned:
Status: Closed Package: Program Execution
PHP Version: master-Git-2015-07-08 (Git) OS: Debian jessie
Private report: No CVE-ID:
 [2015-07-08 08:17 UTC] 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) " "
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-08 08:20 UTC] robbert at muze dot nl
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)
 [2015-07-08 11:36 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da333bfbd8ed9820922957cea70a562454548d84
Log: Fixed bug #70018 (exec does not strip all whitespace)
 [2015-07-08 11:36 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-07-21 14:21 UTC] ab@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da333bfbd8ed9820922957cea70a562454548d84
Log: Fixed bug #70018 (exec does not strip all whitespace)
 [2016-07-20 11:37 UTC] davey@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da333bfbd8ed9820922957cea70a562454548d84
Log: Fixed bug #70018 (exec does not strip all whitespace)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Feb 21 18:01:40 2017 UTC