Merge branch 'PHP-7.2'

* PHP-7.2:
  Fix #76300 - Dont attempt to change visibility of a parent private
This commit is contained in:
Stanislav Malyshev 2018-06-17 15:47:03 -07:00
commit 7d7b7e801e
3 changed files with 482 additions and 476 deletions

View 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

View File

@ -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(