Bug #78937 [NEW]: Preloading unlinkable anonymous class can segfault
| From: | cmb@php.net | Date: | Mon, 09 Dec 2019 13:36:30 +0000 |
| Subject: | Bug #78937 [NEW]: Preloading unlinkable anonymous class can segfault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224169@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.4Git-2019-12-09 (Git)
Package: opcache
Bug Type: Bug
Bug description:Preloading unlinkable anonymous class can segfault
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 bug report at https://bugs.php.net/bug.php?id=78937&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78937&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78937&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78937&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78937&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78937&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78937&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78937&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78937&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78937&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78937&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78937&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78937&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78937&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78937&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78937&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78937&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78937&r=mysqlcfg