Bug #78937 [Opn]: Preloading unlinkable anonymous class can segfault
| From: | cmb@php.net | Date: | Mon, 09 Dec 2019 16:37:55 +0000 |
| Subject: | Bug #78937 [Opn]: Preloading unlinkable anonymous class can segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224174@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78937&edit=1
ID: 78937
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: Preloading unlinkable anonymous class can segfault
Status: Open
Type: Bug
Package: opcache
Operating System: *
PHP Version: 7.4Git-2019-12-09 (Git)
Block user comment: N
Private report: N
New Comment:
Additional info: the preloader uses opcache_compile_file() to
preload preload.inc, and the error log shows:
PHP Warning: Can't preload already declared class class@anonymous in â¦
Previous Comments:
------------------------------------------------------------------------
[2019-12-09 13:36:30] cmb@php.net
Description:
------------
When code is preloaded which uses unlinkable anonymous classes,
PHP can crash. When running the test script in debug mode with
r42a2fb8, I hit an assertion failure:
php7_debug.dll!ZEND_DECLARE_ANON_CLASS_SPEC_HANDLER(_zend_execute_data * execute_data) Line 2449
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\Zend\zend_vm_execute.h:2449)
php7_debug.dll!execute_ex(_zend_execute_data * ex) Line 53379
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\Zend\zend_vm_execute.h:53379)
php7_debug.dll!zend_execute(_zend_op_array * op_array, _zval_struct * return_value) Line 57665
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\Zend\zend_vm_execute.h:57665)
php7_debug.dll!zend_execute_scripts(int type, _zval_struct * retval, int file_count, ...) Line 1664
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\Zend\zend.c:1664)
php7_debug.dll!php_execute_script(_zend_file_handle * primary_file) Line 2619
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\main\main.c:2619)
php.exe!do_cli(int argc, char * * argv) Line 962
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\sapi\cli\php_cli.c:962)
php.exe!main(int argc, char * * argv) Line 1352
(c:\php-sdk\phpdev\vc15\x64\php-src-7.4\sapi\cli\php_cli.c:1352)
Test script:
---------------
preload.inc
<?php
function foo() {
return new class extends Bar {};
}
?>
test.php
<?php
var_dump(foo()->test());
?>
Expected result:
----------------
object(class@anonymous)#1 (0) {
}
Actual result:
--------------
assertion failure/segfault
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78937&edit=1