mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
parent
3f86adb0ef
commit
baf3a9133b
4 changed files with 32 additions and 0 deletions
3
ext/opcache/tests/preload_class_alias.inc
Normal file
3
ext/opcache/tests/preload_class_alias.inc
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
class A {}
|
||||
class_alias(A::class, 'B');
|
17
ext/opcache/tests/preload_class_alias.phpt
Normal file
17
ext/opcache/tests/preload_class_alias.phpt
Normal file
|
@ -0,0 +1,17 @@
|
|||
--TEST--
|
||||
Bug #78918: Class alias during preloading causes assertion failure
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
opcache.preload={PWD}/preload_class_alias.inc
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(class_exists('A'));
|
||||
var_dump(class_exists('B'));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
|
@ -700,6 +700,12 @@ static void zend_persist_class_entry(zval *zv)
|
|||
zend_class_entry *ce = Z_PTR_P(zv);
|
||||
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
/* The same zend_class_entry may be reused by class_alias */
|
||||
zend_class_entry *new_ce = zend_shared_alloc_get_xlat_entry(ce);
|
||||
if (new_ce) {
|
||||
Z_PTR_P(zv) = new_ce;
|
||||
return;
|
||||
}
|
||||
if ((ce->ce_flags & ZEND_ACC_LINKED)
|
||||
&& (ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)
|
||||
&& (ce->ce_flags & ZEND_ACC_PROPERTY_TYPES_RESOLVED)
|
||||
|
|
|
@ -352,6 +352,12 @@ static void zend_persist_class_entry_calc(zval *zv)
|
|||
Bucket *p;
|
||||
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
/* The same zend_class_entry may be reused by class_alias */
|
||||
if (zend_shared_alloc_get_xlat_entry(ce)) {
|
||||
return;
|
||||
}
|
||||
zend_shared_alloc_register_xlat_entry(ce, ce);
|
||||
|
||||
check_property_type_resolution(ce);
|
||||
|
||||
ZCG(is_immutable_class) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue