|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77498 Custom extension Segmentation fault when declare static property
Submitted: 2019-01-22 03:17 UTC Modified: 2019-01-25 09:59 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: liujingfeng dot a at yuewen dot com Assigned: nikic (profile)
Status: Closed Package: Compile Failure
PHP Version: 7.3.1 OS: Linux
Private report: No CVE-ID: None
 [2019-01-22 03:17 UTC] liujingfeng dot a at yuewen dot com
Declare custom extension:

		zend_class_entry ce;

		INIT_CLASS_ENTRY(ce, "FooBar", foobar_methods);
		foo_bar_ce = zend_register_internal_class(&ce TSRMLS_CC);
		zend_declare_property_long(foo_bar_ce, ZEND_STRL("test"), 1, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC TSRMLS_CC);

		return SUCCESS;

Test script:

class Test extends FooBar {


Actual result:
Segmentation fault

(gdb) bt
#0  0x000055890ea15213 in zval_get_type (pz=0x0) at /data/website/php-7.3.1/Zend/zend_types.h:411
#1  0x000055890ea18f54 in zend_do_inheritance (ce=0x7f486b40e018, parent_ce=0x5589112786b0) at /data/website/php-7.3.1/Zend/zend_inheritance.c:904
#2  0x000055890e993961 in do_bind_inherited_class (op_array=0x7f486b479300, opline=0x7f486b485000, class_table=0x5589111552a0, parent_ce=0x5589112786b0, compile_time=1 '\001')
    at /data/website/php-7.3.1/Zend/zend_compile.c:1151
#3  0x000055890e993be3 in zend_do_early_binding () at /data/website/php-7.3.1/Zend/zend_compile.c:1202
#4  0x000055890e9a7403 in zend_compile_top_stmt (ast=0x7f486b47b230) at /data/website/php-7.3.1/Zend/zend_compile.c:8154
#5  0x000055890e9a7394 in zend_compile_top_stmt (ast=0x7f486b47b018) at /data/website/php-7.3.1/Zend/zend_compile.c:8142
#6  0x000055890e96c587 in zend_compile (type=2) at Zend/zend_language_scanner.l:602
#7  0x000055890e96c6da in compile_file (file_handle=0x7fffb1caf210, type=8) at Zend/zend_language_scanner.l:636
#8  0x000055890e7b6dc9 in phar_compile_file (file_handle=0x7fffb1caf210, type=8) at /data/website/php-7.3.1/ext/phar/phar.c:3344
#9  0x000055890e9c4bb1 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /data/website/php-7.3.1/Zend/zend.c:1562
#10 0x000055890e933f3f in php_execute_script (primary_file=0x7fffb1caf210) at /data/website/php-7.3.1/main/main.c:2630
#11 0x000055890ea97fd7 in do_cli (argc=2, argv=0x558911154ec0) at /data/website/php-7.3.1/sapi/cli/php_cli.c:997
#12 0x000055890ea98f4a in main (argc=2, argv=0x558911154ec0) at /data/website/php-7.3.1/sapi/cli/php_cli.c:1389


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-25 09:43 UTC]
-Status: Open +Status: Verified
 [2019-01-25 09:59 UTC]
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2019-01-25 10:05 UTC]
Automatic comment on behalf of
Log: Fixed bug #77498
 [2019-01-25 10:05 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 11:01:27 2023 UTC