- Reflection:
. Fixed bug #79487 (::getStaticProperties() ignores property modifications).
(cmb, Nikita)
- . Fixed bug #69804 ()::getStaticPropertyValue() throws on protected props).
+ . Fixed bug #69804 (::getStaticPropertyValue() throws on protected props).
(cmb, Nikita)
+ . Fixed bug #79820 (Use after free when type duplicated into
+ ReflectionProperty gets resolved). (Christopher Broadbent)
- Standard:
. Fixed bug #70362 (Can't copy() large 'data://' with open_basedir). (cmb)
case REF_TYPE_PROPERTY:
prop_reference = (property_reference*)intern->ptr;
zend_string_release_ex(prop_reference->unmangled_name, 0);
+
+ if (ZEND_TYPE_IS_NAME(prop_reference->prop.type)) {
+ zend_string_release(ZEND_TYPE_NAME(prop_reference->prop.type));
+ }
+
efree(intern->ptr);
break;
case REF_TYPE_GENERATOR:
intern = Z_REFLECTION_P(object);
reference = (property_reference*) emalloc(sizeof(property_reference));
reference->prop = *prop;
+
+ if (ZEND_TYPE_IS_NAME(reference->prop.type)) {
+ zend_string_addref(ZEND_TYPE_NAME(reference->prop.type));
+ }
+
reference->unmangled_name = zend_string_copy(name);
reference->dynamic = dynamic;
intern->ptr = reference;
property_info_tmp.name = name;
property_info_tmp.doc_comment = NULL;
property_info_tmp.ce = ce;
+ property_info_tmp.type = 0;
reflection_property_factory(ce, name, &property_info_tmp, return_value, 1);
return;
property_info.name = key;
property_info.ce = ce;
property_info.offset = -1;
+ property_info.type = 0;
reflection_property_factory(ce, key, &property_info, &property, 1);
add_next_index_zval(retval, &property);
}
reference->prop.name = name;
reference->prop.doc_comment = NULL;
reference->prop.ce = ce;
+ reference->prop.type = 0;
reference->dynamic = 1;
} else {
reference->prop = *property_info;
reference->dynamic = 0;
+
+ if (ZEND_TYPE_IS_NAME(reference->prop.type)) {
+ zend_string_addref(ZEND_TYPE_NAME(reference->prop.type));
+ }
}
reference->unmangled_name = zend_string_copy(name);
intern->ptr = reference;
--- /dev/null
+--TEST--
+Bug #79820: Use after free when type duplicated into ReflectionProperty gets resolved
+--FILE--
+<?php
+
+class Test {
+ public stdClass $prop;
+}
+
+$rp = new ReflectionProperty(Test::class, 'prop');
+$test = new Test;
+$test->prop = new stdClass;
+var_dump($rp->getType()->getName());
+$test->dynProp = 42;
+
+$rp = new ReflectionProperty($test, 'dynProp');
+var_dump($rp->getType());
+
+?>
+--EXPECT--
+string(8) "stdClass"
+NULL