#20905 [Ana->Csd]: exec() vs file() with newlines
| From: | philip@php.net | Date: | Sun, 19 Jan 2003 06:48:01 +0000 |
| Subject: | #20905 [Ana->Csd]: exec() vs file() with newlines | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969351054@lists.php.net to get a copy of this message | ||
ID: 20905
Updated by: philip@php.net
Reported By: greg@mtechsolutions.ca
-Status: Analyzed
+Status: Closed
Bug Type: Documentation problem
Operating System: linux
PHP Version: 4.2.2
New Comment:
This is now documented:
http://cvs.php.net/cvs.php/phpdoc/en/reference/exec/functions/exec.xml
Thanks for the report :)
Previous Comments:
------------------------------------------------------------------------
[2002-12-09 07:29:02] sniper@php.net
Reclassified.
The manual page for 'file()' does mention this.
But it should be mentionaed for 'exec()' too..(the optional array
output parameter..)
------------------------------------------------------------------------
[2002-12-09 07:25:48] greg@mtechsolutions.ca
This is just basically an inconsistency between file() and exec()
file() will return the newline on the end of each element in the array,
ie:
$data = file("somefile.txt");
$data[0][ strlen($data[0])-1 ] == "\n"
but exec() doesn't put newlines on it's output:
exec("soemthing", $data);
$data[0][ strlen($data[0])-1 ] != "\n"
At the least, the manual page for file() and/or exec() should state
this behaviour.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20905&edit=1