php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5775 \0 when exec returns with an empty stdout
Submitted: 2000-07-25 03:26 UTC Modified: 2000-08-01 09:20 UTC
From: iliaa at home dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.0 OS: FreeBSD 3.3 RELEASE/Linux 2.2.16
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
30 + 11 = ?
Subscribe to this entry?

 
 [2000-07-25 03:26 UTC] iliaa at home dot com
PHP seems to consider \0 (NULL chracter) a valid value.
As the result check such as if($val) is true.

Example Code:
<?
$ret_val = exec("ps -p 1 | grep shit");
if( $ret_val ) {
	echo "this shouldn't happen\n";
}
 
echo ord($ret_val)."\n";
echo strlen($ret_val)."\n";
?>

Maybe the type juggling mechanism gets confused?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-25 11:55 UTC] stas@php.net
Well, seems to be a bug, in meaning that when command returns nothing, return value is "\0" and not empty.
 [2000-08-01 09:20 UTC] stas@php.net
Fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 16:01:29 2024 UTC