php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: liujingfeng dot a at yuewen dot com
New email:
PHP Version: OS:

 

 [2019-01-22 03:17 UTC] liujingfeng dot a at yuewen dot com
Description:
------------
Declare custom extension:

PHP_MINIT_FUNCTION(foobar) {
		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:
---------------
<?php

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-25 09:43 UTC] nikic@php.net
-Status: Open +Status: Verified
 [2019-01-25 09:59 UTC] nikic@php.net
-Status: Verified +Status: Assigned -Assigned To: +Assigned To: nikic
 [2019-01-25 10:05 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f78e681428a368930860162a1ea9b23b1a07666f
Log: Fixed bug #77498
 [2019-01-25 10:05 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Mar 31 07:01:29 2025 UTC