PHP 4.0 Bug #5775: \0 when exec returns with an empty stdout
| From: | iliaa at home dot com | Date: | Tue, 25 Jul 2000 01:26:29 +0000 |
| Subject: | PHP 4.0 Bug #5775: \0 when exec returns with an empty stdout | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25920@lists.php.net to get a copy of this message | ||
From: iliaa@home.com
Operating system: FreeBSD 3.3 RELEASE/Linux 2.2.16
PHP version: 4.0.0
PHP Bug Type: Scripting Engine problem
Bug description: \0 when exec returns with an empty stdout
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?