mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Merge branch 'PHP-7.2'
* PHP-7.2: Fix #76300 - Dont attempt to change visibility of a parent private
This commit is contained in:
commit
7d7b7e801e
29
ext/standard/tests/serialize/bug76300.phpt
Normal file
29
ext/standard/tests/serialize/bug76300.phpt
Normal file
@ -0,0 +1,29 @@
|
||||
--TEST--
|
||||
Bug #76300: Unserialize of extended protected member broken
|
||||
--FILE--
|
||||
<?php
|
||||
class Base {
|
||||
private $id;
|
||||
public function __construct($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
class Derived extends Base {
|
||||
protected $id;
|
||||
public function __construct($id)
|
||||
{
|
||||
parent::__construct($id + 20);
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
$a = new Derived(44);
|
||||
$s = serialize($a);
|
||||
$u = unserialize($s);
|
||||
print_r($u);
|
||||
--EXPECT--
|
||||
Derived Object
|
||||
(
|
||||
[id:protected] => 44
|
||||
[id:Base:private] => 64
|
||||
)
|
File diff suppressed because it is too large
Load Diff
@ -457,7 +457,8 @@ string_key:
|
||||
unmangled = zend_string_init(unmangled_prop, unmangled_prop_len, 0);
|
||||
|
||||
existing_propinfo = zend_hash_find_ptr(&Z_OBJCE_P(rval)->properties_info, unmangled);
|
||||
if ((existing_propinfo != NULL)
|
||||
if ((unmangled_class == NULL || !strcmp(unmangled_class, "*") || !strcasecmp(unmangled_class, ZSTR_VAL(Z_OBJCE_P(rval)->name)))
|
||||
&& (existing_propinfo != NULL)
|
||||
&& (existing_propinfo->flags & ZEND_ACC_PPP_MASK)) {
|
||||
if (existing_propinfo->flags & ZEND_ACC_PROTECTED) {
|
||||
new_key = zend_mangle_property_name(
|
||||
|
Loading…
Reference in New Issue
Block a user