1
0
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:
Dmitry Stogov
2022-12-19 12:11:55 +03:00
2 changed files with 14 additions and 0 deletions

View 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) " "

View File

@@ -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) {