php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #20905 exec() vs file() with newlines
Submitted: 2002-12-09 07:25 UTC Modified: 2003-01-19 00:48 UTC
From: greg at mtechsolutions dot ca Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.2 OS: linux
Private report: No CVE-ID: None
 [2002-12-09 07:25 UTC] greg at mtechsolutions dot 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.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-09 07:29 UTC] 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..)

 [2003-01-19 00:48 UTC] philip@php.net
This is now documented:
http://cvs.php.net/cvs.php/phpdoc/en/reference/exec/functions/exec.xml

Thanks for the report :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 03:01:28 2024 UTC