Bug #10523 Updated: get_defined_functions inserts a whitespace at the end of each value.
| From: | andrei@php.net | Date: | Fri, 27 Apr 2001 13:15:58 +0000 |
| Subject: | Bug #10523 Updated: get_defined_functions inserts a whitespace at the end of each value. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52580@lists.php.net to get a copy of this message | ||
ID: 10523
Updated by: andrei
Reported By: maxim@maxim.cx
Old-Status: Open
Status: Closed
Bug Type: Class/Object related
PHP Version: 4.0.4pl1
Assigned To:
Comments:
This has been fixed for 4.0.5.
Previous Comments:
---------------------------------------------------------------------------
[2001-04-27 06:38:06] maxim@maxim.cx
Hi,
I spent an hour to understand why this simple code did not work for me:
// $functions: an array of the Db specific functions I care of.
// they are in form 'connect', 'query' etc...
$existing = get_defined_functions();
foreach($functions as $k=>$v) {
$f = $dbms.$v;
printf("%s $f<BR>", in_array($f, $existing['internal']) ? '+'
: '-');
}
It did not return me anything at all, although it should.
The problem was:
get_defined_functions() returns a two dimensional array, in which all the values (functions) are
having a (whitespace?) 'ORD(0)' at the end.
you can check it with this:
$func = get_defined_functions();
echo '<PRE>';
foreach($func['internal'] as $k=>$v) {
printf("ASCII: '%d' tvalue: '%s'n", ord(substr($v, -1)), $v);
}
echo '</PRE>';
// the returns the following:
ASCII: '0' value: 'zend_version'
ASCII: '0' value: 'func_num_args'
ASCII: '0' value: 'func_get_arg'
and so on...
I believe that's a bug, no?
Maxim Maletsky,
maxim@maixm.cx
PHPBeginner.com
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10523&edit=2