php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49997 Implementing a namespaced interface crashes
Submitted: 2009-10-26 13:22 UTC Modified: 2009-11-19 01:00 UTC
Votes:5
Avg. Score:5.0 ± 0.0
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:2 (40.0%)
From: flavius dot as at gmail dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.3.0 OS: Linux x86_64
Private report: No CVE-ID: None
 [2009-10-26 13:22 UTC] flavius dot as at gmail dot com
Description:
------------
PHP 5.3.0 crashes when a class is implementing an interface declared in another namespace

Reproduce code:
---------------
Hi

I am sorry, I was unable to isolate the bug and create a PoC.
However the code (which is rather small) can be found at svn://yet-another-project.com/projects/yap.

Rev 1. is working, but the crashing code is commented out, Rev.2 crashes when issuing /trunk/tests/runtests.sh.

The tests were written with PHPUnit 3.4.1 in mind.
The error message when running the testsuite through /usr/bin/phpunit is:
./runtests.sh: line 3: 16512 Segmentation fault      phpunit --bootstrap bootstrap.php --configuration phpunit.xml testunit/

But when issuing /usr/bin/php /usr/bin/phpunit --bootstrap bootstrap.php --configuration phpunit.xml testunit/ I only get:
Segmentation fault

See the diff between r1 and r2.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-26 14:39 UTC] johannes@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2009-10-26 16:54 UTC] flavius dot as at gmail dot com
Done. The output:

Reading symbols from /home/flav/php-5.3.0/sapi/cli/php...done.
(gdb) run /usr/bin/phpunit --bootstrap bootstrap.php --configuration phpunit.xml testunit/
Starting program: /home/flav/php-5.3.0/sapi/cli/php /usr/bin/phpunit --bootstrap bootstrap.php --configuration phpunit.xml testunit/
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00000000007d93db in ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER (execute_data=0x7ffff65529a8) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:892
892             if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
(gdb) bt
#0  0x00000000007d93db in ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER (execute_data=0x7ffff65529a8) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:892
#1  0x00000000007d6b50 in execute (op_array=0x161f078) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:104
#2  0x00000000007a38de in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/flav/php-5.3.0/Zend/zend.c:1188
#3  0x000000000072ed19 in php_execute_script (primary_file=0x7fffffffe1e0) at /home/flav/php-5.3.0/main/main.c:2196
#4  0x000000000088c885 in main (argc=7, argv=0x7fffffffe438) at /home/flav/php-5.3.0/sapi/cli/php_cli.c:1188
 [2009-10-28 19:27 UTC] flavius dot as at gmail dot com
After some debugging, I came to the conclusion that it crashes because of an exception being thrown inside a spl_register_autoload()'ed userland method.

Here's the bt:

#0  zend_lookup_class_ex (name=0x15b9d40 "Exception", name_length=9, use_autoload=1, ce=0x7fffffffb2e0) at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1016
#1  0x00000000007954d1 in zend_fetch_class (class_name=0x15b9d40 "Exception", class_name_len=9, fetch_type=4)
    at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1524
#2  0x00000000007d8d22 in ZEND_FETCH_CLASS_SPEC_CONST_HANDLER (execute_data=0x7ffff6552cc0) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:724
#3  0x00000000007d6b50 in execute (op_array=0x15bc828) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:104
#4  0x00000000007940e5 in zend_call_function (fci=0x7fffffffb640, fci_cache=0x7fffffffb5d0) at /home/flav/php-5.3.0/Zend/zend_execute_API.c:936
#5  0x00000000007bfae4 in zend_call_method (object_pp=0x0, obj_ce=0x15b8eb0, fn_proxy=0x15b09f8, function_name=0x15ba410 "\\yap\\base::autoload",
    function_name_len=20, retval_ptr_ptr=0x7fffffffb748, param_count=1, arg1=0x15f8930, arg2=0x0) at /home/flav/php-5.3.0/Zend/zend_interfaces.c:97
#6  0x0000000000600de0 in zif_spl_autoload_call (ht=1, return_value=0x161c620, return_value_ptr=0x7fffffffba70, this_ptr=0x0, return_value_used=1)
    at /home/flav/php-5.3.0/ext/spl/php_spl.c:395
#7  0x00000000007942c2 in zend_call_function (fci=0x7fffffffba20, fci_cache=0x7fffffffb9f0) at /home/flav/php-5.3.0/Zend/zend_execute_API.c:958
#8  0x0000000000794999 in zend_lookup_class_ex (name=0x15f8a30 "YAP\\patterns\\IInheritable", name_length=25, use_autoload=1, ce=0x7fffffffbb20)
    at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1089
#9  0x00000000007954d1 in zend_fetch_class (class_name=0x15f8a30 "YAP\\patterns\\IInheritable", class_name_len=25, fetch_type=6)
    at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1524
#10 0x00000000007d93d3 in ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER (execute_data=0x7ffff6552bb8) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:890
#11 0x00000000007d6b50 in execute (op_array=0x15f68c8) at /home/flav/php-5.3.0/Zend/zend_vm_execute.h:104
#12 0x00000000007a38de in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/flav/php-5.3.0/Zend/zend.c:1188
#13 0x000000000072ed19 in php_execute_script (primary_file=0x7fffffffe1b0) at /home/flav/php-5.3.0/main/main.c:2196
#14 0x000000000088c885 in main (argc=7, argv=0x7fffffffe408) at /home/flav/php-5.3.0/sapi/cli/php_cli.c:1188
 [2009-10-28 19:30 UTC] flavius dot as at gmail dot com
Sorry for the incomplete post.

This happens in my scripts because it's trying to autoload an interface.
My code was indeed buggy, but I woudn't expect PHP to crash.
 [2009-11-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-11-03 05:59 UTC] flavius dot as at gmail dot com
Could someone do something with this report?
 [2009-11-03 10:22 UTC] scottmac@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

There was a fix for autoload crashing on an interface in bug #49908
 [2009-11-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-11-12 00:51 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-11-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 31 13:00:03 2025 UTC