php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39216 call_user_func and friends don't accept array($this, "func") callback anymore
Submitted: 2006-10-20 17:00 UTC Modified: 2007-10-22 22:36 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: hannes dot magnusson at gmail dot com Assigned: johannes (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 6CVS-2006-10-20 (CVS) OS: FreeBSD
Private report: No CVE-ID: None
 [2006-10-20 17:00 UTC] hannes dot magnusson at gmail dot com
Description:
------------
call_user_func()/array_walk() doesn't accept 
array($obj, "func") callback anymore...

(See Zend/tests/bug31720.phpt && Zend/tests/bug19859.phpt)

Reproduce code:
---------------
<?php
$array = array('at least one element');

array_walk($array, array($nonesuchvar,'show'));
?>


Expected result:
----------------
Notice: Undefined variable: nonesuchvar in %s on line %d

Notice: Non-callable array passed to zend_call_function() 
in %s on line %d

Warning: array_walk(): Unable to call Array() - function 
does not exist in %s on line %d


Actual result:
--------------
Notice: Undefined variable: nonesuchvar 
in /usr/src/php/6.0/Zend/tests/bug31720.php on line 4

Warning: array_walk() expects parameter 2 to be valid 
callback, array given 
in /usr/src/php/6.0/Zend/tests/bug31720.php on line 4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-21 08:44 UTC] judas dot iscariote at gmail dot com
reproduced with preg_replace_callback too .. ;-)
 [2006-10-21 16:15 UTC] hannes dot magnusson at gmail dot com
ext/standard/tests/general_functions/bug35229.php

#0  0x083aaf1e in zend_call_function (fci=0xbfbfd010, 
fci_cache=0xbfbfd000, tsrm_ls=0x85742e0) 
at /usr/src/php/6.0/Zend/zend_execute_API.c:957
#1  0x082a3082 in zif_call_user_func (ht=31, 
return_value=0x87f395c, return_value_ptr=0x0, 
this_ptr=0x0, return_value_used=0, tsrm_ls=0x85742e0)
    
at /usr/src/php/6.0/ext/standard/basic_functions.c:5030
#2  0x083e9da1 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfbfd170, tsrm_ls=0x85742e0) at 
zend_vm_execute.h:209
#3  0x083ef52c in ZEND_DO_FCALL_SPEC_CONST_HANDLER 
(execute_data=0xbfbfd170, tsrm_ls=0x85742e0) at 
zend_vm_execute.h:1648
#4  0x083e98d1 in execute (op_array=0x87f19c8, 
tsrm_ls=0x85742e0) at zend_vm_execute.h:92
#5  0x083bee9e in zend_execute_scripts (type=8, 
tsrm_ls=0x85742e0, retval=0x0, file_count=3) 
at /usr/src/php/6.0/Zend/zend.c:1616
#6  0x08356e16 in php_execute_script 
(primary_file=0xbfbfe900, tsrm_ls=0x85742e0) 
at /usr/src/php/6.0/main/main.c:1922
#7  0x084382f3 in main (argc=2, argv=0xbfbfe974) 
at /usr/src/php/6.0/sapi/cli/php_cli.c:1119
 [2007-04-23 13:26 UTC] tony2001@php.net
The Zend/tests/bug19859.phpt is still broken, others seem to be fixed.
Marcus, your fcall_info stuff breaks it, please look into it.
I tried to fix it, but got lost in the code you wrote.
zend_call_function() should detect if __call() is used and pass the real function name as the first param.
 [2007-04-29 12:49 UTC] stas@php.net
Can someone enlighten me how the reproduce code is supposed to do anything? You can't call methods on non-existing objects...
 [2007-10-22 22:36 UTC] johannes@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed already in April by me
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 21:01:33 2025 UTC