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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: greg at mtechsolutions dot ca
New email:
PHP Version: OS:

 

 [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

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: Wed Sep 11 16:01:28 2024 UTC