#48770 [Com]: call_user_func_array fails to call parent from inheriting class

[email protected] ("sjoerd-php at linuxonly dot nl")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               48770
 Comment by:       sjoerd-php at linuxonly dot nl
 Reported By:      lumeet at yahoo dot com
 Status:           Open
 Bug Type:         Reproducible crash
 Operating System: Windows XP SP3
 PHP Version:      5.3CVS-2009-07-02 (snap)
 New Comment:

Thank you for your bug report. I could reproduce it and added some more
data:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7d03b80 (LWP 6726)]
0x082dee15 in zend_is_callable_ex (callable=0x9e3cdc0, object_ptr=0x0,

    check_flags=0, callable_name=0x0, callable_name_len=0x0,
fcc=0xbf49d190, 
    error=0xbf49d0e8) at
/home/sjoerd/dev/php/trunk/php5/Zend/zend_API.c:2624
2624	{
#0  0x082dee15 in zend_is_callable_ex (callable=0x9e3cdc0,
object_ptr=0x0, 
    check_flags=0, callable_name=0x0, callable_name_len=0x0,
fcc=0xbf49d190, 
    error=0xbf49d0e8) at
/home/sjoerd/dev/php/trunk/php5/Zend/zend_API.c:2624
#1  0x082df489 in zend_fcall_info_init (callable=0x9e3cdc0,
check_flags=0, 
    fci=0xbf49d16c, fcc=0xbf49d190, callable_name=0x0,
error=0xbf49d0e8)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_API.c:2858
#2  0x082e35a2 in zend_parse_va_args (num_args=2, type_spec=0x85b0091
"a/", 
    va=0xbf49d13c, flags=0)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_API.c:592
#3  0x082e3d12 in zend_parse_parameters (num_args=2,
type_spec=0xbf49d0e8 "")
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_API.c:870
#4  0x08220dd1 in zif_call_user_func_array (ht=2,
return_value=0x9e3ce7c, 
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at
/home/sjoerd/dev/php/trunk/php5/ext/standard/basic_functions.c:4748
#5  0x083259b9 in zend_do_fcall_common_helper_SPEC
(execute_data=0x9de07bc)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:313
#6  0x08302dbe in execute (op_array=0x9448e90)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:104
#7  0x082d0c77 in zend_call_function (fci=0xbf49d37c,
fci_cache=0xbf49d3a0)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_execute_API.c:936
#8  0x08220df7 in zif_call_user_func_array (ht=2,
return_value=0x9e3ccb0, 
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at
/home/sjoerd/dev/php/trunk/php5/ext/standard/basic_functions.c:4755
#9  0x083259b9 in zend_do_fcall_common_helper_SPEC
(execute_data=0x9de06fc)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:313
#10 0x08302dbe in execute (op_array=0x9448e90)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:104
#11 0x082d0c77 in zend_call_function (fci=0xbf49d58c,
fci_cache=0xbf49d5b0)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_execute_API.c:936
#12 0x08220df7 in zif_call_user_func_array (ht=2,
return_value=0x9e3cae4, 
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at
/home/sjoerd/dev/php/trunk/php5/ext/standard/basic_functions.c:4755

...

#11213 0x083259b9 in zend_do_fcall_common_helper_SPEC
(execute_data=0x9c1d004)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:313
#11214 0x08302dbe in execute (op_array=0x9448e90)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:104
#11215 0x082d0c77 in zend_call_function (fci=0xbf60669c,
fci_cache=0xbf6066c0)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_execute_API.c:936
#11216 0x08220df7 in zif_call_user_func_array (ht=2,
return_value=0x9c822d4, 
    return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
    at
/home/sjoerd/dev/php/trunk/php5/ext/standard/basic_functions.c:4755
#11217 0x083259b9 in zend_do_fcall_common_helper_SPEC
(execute_data=0x9c1cf44)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:313
#11218 0x08302dbe in execute (op_array=0x9448e90)
    at /home/sjoerd/dev/php/trunk/php5/Zend/zend_vm_execute.h:104
etc. etc.


Previous Comments:
------------------------------------------------------------------------

[2009-07-02 07:28:31] lumeet at yahoo dot com

Description:
------------
When class C extends B, which extends A, calls from B to its parent 
methods fail when using call_user_func_array(). Using parent::func()
works just fine.

Reproduce code:
---------------
class A {
  function func( $str ) {
    echo $str;
  }
}

class B extends A {
  public function func( $str ) {
    call_user_func_array( array( $this, 'parent::func' ), array( $str )
);
  }
}

class C extends B {
  public function func( $str ) {
    parent::func( $str );
  }
}

$c = new C;
$c->func( 'This should work!' );

Expected result:
----------------
The code should output "This should work!".

Actual result:
--------------
PHP crashes with backtrace (yes, only one line):

Function     Arg 1     Arg 2     Arg 3   Source 
php5ts!zend_is_callable_ex+61e     011f0780     00000006     003228e0  
 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48770&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.