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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: iliaa at home dot com
New email:
PHP Version: OS:

 

 [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: Fri Apr 19 15:01:28 2024 UTC