#33790 [NEW]: Exec command trims spaces from output
| From: | marcus at names dot co dot uk | Date: | Wed, 20 Jul 2005 15:11:11 +0000 |
| Subject: | #33790 [NEW]: Exec command trims spaces from output | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-82218@lists.php.net to get a copy of this message | ||
From: marcus at names dot co dot uk
Operating system: Linux 2.4
PHP version: 4.4.0
PHP Bug Type: Unknown/Other Function
Bug description: Exec command trims spaces from output
Description:
------------
Each line in the output array returned as the second
parameter of exec() is trimmed so that all white space
is removed, rather than just new line characters.
I found this issue while trying to use the following
command to find all files in the current directory whose
name ends in a space:
exec("find . -name '* '",$output_array,$status);
However, in $output_array the filenames have been
trimmed so that they no longer end in a space.
Reproduce code:
---------------
exec("find . -name '* '",$output_array,$status);
Expected result:
----------------
array(
"file1 "
"file2 "
);
Actual result:
--------------
array(
"file1"
"file2"
);
--
Edit bug report at http://bugs.php.net/?id=33790&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33790&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33790&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33790&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33790&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33790&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33790&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33790&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33790&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33790&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33790&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33790&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33790&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33790&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33790&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33790&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33790&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33790&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33790&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33790&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33790&r=mysqlcfg