mirror of
https://github.com/php/php-src.git
synced 2026-04-02 05:32:28 +02:00
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix memory leak
This commit is contained in:
13
Zend/tests/class_constants_007.phpt
Normal file
13
Zend/tests/class_constants_007.phpt
Normal file
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Ownership of constant expression inhereted from immutable class should be transfered to class
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
const X = ' ' . self::Y;
|
||||
const Y = ' ';
|
||||
}
|
||||
eval('class B extends A{}');
|
||||
var_dump(B::X);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(2) " "
|
||||
@@ -1385,6 +1385,7 @@ static void do_inherit_class_constant(zend_string *name, zend_class_constant *pa
|
||||
c = zend_arena_alloc(&CG(arena), sizeof(zend_class_constant));
|
||||
memcpy(c, parent_const, sizeof(zend_class_constant));
|
||||
parent_const = c;
|
||||
Z_CONSTANT_FLAGS(c->value) |= CONST_OWNED;
|
||||
}
|
||||
}
|
||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||
|
||||
Reference in New Issue
Block a user