#20905 [Opn->Ana]: exec() vs file() with newlines

From: Date: Mon, 09 Dec 2002 13:29:02 +0000
Subject: #20905 [Opn->Ana]: exec() vs file() with newlines
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969350247@lists.php.net to get a copy of this message
ID: 20905 Updated by: sniper@php.net Reported By: greg@mtechsolutions.ca -Status: Open +Status: Analyzed -Bug Type: Filesystem function related +Bug Type: Documentation problem Operating System: linux PHP Version: 4.2.2 New Comment: Reclassified. The manual page for 'file()' does mention this. But it should be mentionaed for 'exec()' too..(the optional array output parameter..) Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc (#969350247) next »