|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10523 get_defined_functions inserts a whitespace at the end of each value.
Submitted: 2001-04-27 06:38 UTC Modified: 2001-04-27 09:15 UTC
From: maxim at maxim dot cx Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.4pl1 OS: Win2k
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.
Block user comment
Status: Assign to:
Bug Type:
From: maxim at maxim dot cx
New email:
PHP Version: OS:


 [2001-04-27 06:38 UTC] maxim at maxim dot cx

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,


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-27 09:15 UTC]
This has been fixed for 4.0.5.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 10:01:26 2023 UTC