From: Operating system: Any PHP version: 5.4.3 Package: *Compile Issues Bug Type: Bug Bug description:Segfault during inheritance check on method
Description: ------------ When inherited method has different type hinting information for the method parameters and E_STRICT error reporting level is set - PHP tries to report method declaration incompatibility and segfaults on attempt to dereference a null pointer. Test script: --------------- <?php class A {} class B { public function b(A $a) {} } class C extends B { public function b($a) {} } $a = new C(); Expected result: ---------------- Valid message explaining that inherited method has a different signature. Actual result: -------------- $ php a.php Segmentation fault (core dumped) ... (gdb) bt #0 zend_get_function_declaration (fptr=0x0) at /usr/src/debug/php-5.4.3/Zend/zend_compile.c:3046 #1 0x00000000005a2479 in do_inheritance_check_on_method (child= 0x7ffff7fc3558, parent=0x7ffff7fc3f18) at /usr/src/debug/php-5.4.3/Zend/zend_compile.c:3267 #2 0x00000000005a2665 in do_inherit_method_check ( child_function_table=<value optimized out>, parent=<value optimized out>, hash_key=<value optimized out>, child_ce=0x7ffff7fc3310) at /usr/src/debug/php-5.4.3/Zend/zend_compile.c:3288 #3 0x00000000005d3cf1 in zend_hash_replace_checker_wrapper (target= 0x7ffff7fc3338, source=<value optimized out>, pCopyConstructor= 0x5a7bc0 <do_inherit_method>, size=240, pMergeSource= 0x5a2620 <do_inherit_method_check>, pParam=0x7ffff7fc3310) at /usr/src/debug/php-5.4.3/Zend/zend_hash.c:878 #4 zend_hash_merge_ex (target=0x7ffff7fc3338, source=<value optimized out>, pCopyConstructor=0x5a7bc0 <do_inherit_method>, size=240, pMergeSource= 0x5a2620 <do_inherit_method_check>, pParam=0x7ffff7fc3310) at /usr/src/debug/php-5.4.3/Zend/zend_hash.c:892 #5 0x00000000005a850b in zend_do_inheritance (ce=0x7ffff7fc3310, parent_ce= 0x7ffff7fc2ff8) at /usr/src/debug/php-5.4.3/Zend/zend_compile.c:3519 #6 0x00000000005a962c in do_bind_inherited_class ( op_array=<value optimized out>, opline=<value optimized out>, class_table= 0xdf4c30, parent_ce=0x7ffff7fc2ff8, compile_time=1 '\001') at /usr/src/debug/php-5.4.3/Zend/zend_compile.c:4569 #7 0x00000000005a985a in zend_do_early_binding () at /usr/src/debug/php-5.4.3/Zend/zend_compile.c:4626 #8 0x000000000058c1ca in zendparse () at /usr/src/debug/php-5.4.3/Zend/zend_language_parser.c:3547 #9 0x000000000058fa0d in compile_file (file_handle=0x7fffffffdec0, type=<value optimized out>) at Zend/zend_language_scanner.l:579 #10 0x00007fffeb6d4042 in phar_compile_file (file_handle=0x7fffffffdec0, type= 8) at /usr/src/debug/php-5.4.3/ext/phar/phar.c:3391 #11 0x00007ffff1d8101d in xdebug_compile_file ( file_handle=<value optimized out>, type=<value optimized out>) at /usr/src/debug/php-pecl-xdebug-2.2.0/xdebug-2.2.0/xdebug.c:1537 #12 0x00000000005c70ca in zend_execute_scripts (type=8, retval=0x0, file_count= 3) at /usr/src/debug/php-5.4.3/Zend/zend.c:1264 #13 0x0000000000566cc3 in php_execute_script (primary_file=0x7fffffffdec0) at /usr/src/debug/php-5.4.3/main/main.c:2473 #14 0x0000000000672395 in do_cli (argc=2, argv=0x7fffffffe1f8) at /usr/src/debug/php-5.4.3/sapi/cli/php_cli.c:983 #15 0x0000000000672cbc in main (argc=2, argv=0x7fffffffe1f8) at /usr/src/debug/php-5.4.3/sapi/cli/php_cli.c:1356 -- Edit bug report at https://bugs.php.net/bug.php?id=62084&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62084&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62084&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62084&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62084&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62084&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62084&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62084&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62084&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62084&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62084&r=support Expected behavior: https://bugs.php.net/fix.php?id=62084&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62084&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62084&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62084&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62084&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62084&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62084&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62084&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62084&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62084&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62084&r=mysqlcfg