PHP 4.0 Bug #7869: parse_str produces no trapable value
| From: | bens at benjamindsmith dot com | Date: | Sat, 18 Nov 2000 03:05:57 +0000 |
| Subject: | PHP 4.0 Bug #7869: parse_str produces no trapable value | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38458@lists.php.net to get a copy of this message | ||
From: bens@benjamindsmith.com
Operating system: RH Linux 6.2
PHP version: 4.0.3pl1
PHP Bug Type: Feature/Change Request
Bug description: parse_str produces no trapable value
<?
$string="?a=1&b=2";
if (!false===parse_str($string))
{
// all is happy
}
else {
// Whoops! error handling...
}
?>
I would submit that to maintain the elegant conventions of PHP, it would be good to return
A) The number of variables parsed (I'll leave in your court how to handle counting the # of
array variables parsed)
or
B) false if the string was null, corrupt or "un-parsable".
Currently, the only way to evaluate the success of this function is to know the last variable that
is/should be in the input stream and check to see that THAT variable exists after running this
function = less than optimum.
Thanks!
-Ben
--
Edit Bug report at: http://bugs.php.net/?id=7869&edit=1