1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-19548: remove ZEND_ACC_OVERRIDE on property inheritance only if it's not part of shared memory

Closes GH-19551
This commit is contained in:
Alexandre Daubois
2025-08-22 10:31:01 +02:00
committed by Ilija Tovilo
parent 4a1789cc34
commit 595abeef3f
4 changed files with 53 additions and 1 deletions

2
NEWS
View File

@@ -15,6 +15,8 @@ PHP NEWS
. Added support for configuring the URI parser for the FTP/FTPS as well as
the SSL/TLS stream wrappers as described in
https://wiki.php.net/rfc/url_parsing_api#plugability. (kocsismate)
. Fixed bug GH-19548 (Shared memory violation on property inheritance).
(alexandre-daubois)
- Filter:
. Added support for configuring the URI parser for FILTER_VALIDATE_URL

View File

@@ -0,0 +1,19 @@
--TEST--
GH-19548: Segfault when using inherited properties and opcache
--FILE--
<?php
interface I {
public mixed $i { get; }
}
class P {
public mixed $i;
}
class C extends P implements I {}
echo "Test passed - no segmentation fault\n";
?>
--EXPECT--
Test passed - no segmentation fault

View File

@@ -0,0 +1,29 @@
--TEST--
GH-19548: Segfault when using inherited properties and opcache (multiple properties)
--FILE--
<?php
interface I1 {
public mixed $a { get; }
public mixed $b { get; }
}
class P1 {
public mixed $a;
public mixed $b;
}
class C1 extends P1 implements I1 {}
interface I2 {
public mixed $prop { get; }
}
class P2 {
public mixed $prop;
}
class Q2 extends P2 {}
class C2 extends Q2 implements I2 {}
echo "Multiple property test passed - no segmentation fault\n";
?>
--EXPECT--
Multiple property test passed - no segmentation fault

View File

@@ -1564,7 +1564,9 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
ZSTR_VAL(parent_info->ce->name));
}
child_info->flags &= ~ZEND_ACC_OVERRIDE;
if (child_info->ce == ce) {
child_info->flags &= ~ZEND_ACC_OVERRIDE;
}
}
} else {
zend_function **hooks = parent_info->hooks;