Skip to content

Commit fad23de

Browse files
committed
Remove BP_VAR_R handling from zend_std_get_property_ptr_ptr()
zend_std_get_property_ptr_ptr() is meant to be used for modifying operations.
1 parent 8b4ef3a commit fad23de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Zend/zend_object_handlers.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,8 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
13911391
uintptr_t property_offset;
13921392
const zend_property_info *prop_info = NULL;
13931393

1394+
ZEND_ASSERT(type != BP_VAR_R && type != BP_VAR_IS);
1395+
13941396
#if DEBUG_OBJECT_HANDLERS
13951397
fprintf(stderr, "Ptr object #%d property: %s\n", zobj->handle, ZSTR_VAL(name));
13961398
#endif
@@ -1412,7 +1414,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
14121414

14131415
return zend_std_get_property_ptr_ptr(zobj, name, type, cache_slot);
14141416
}
1415-
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
1417+
if (UNEXPECTED(type == BP_VAR_RW)) {
14161418
if (prop_info) {
14171419
zend_typed_property_uninitialized_access(prop_info, name);
14181420
retval = &EG(error_zval);
@@ -1473,7 +1475,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
14731475
if (UNEXPECTED(!zobj->properties)) {
14741476
rebuild_object_properties_internal(zobj);
14751477
}
1476-
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
1478+
if (UNEXPECTED(type == BP_VAR_RW)) {
14771479
zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
14781480
}
14791481
retval = zend_hash_add(zobj->properties, name, &EG(uninitialized_zval));

0 commit comments

Comments
 (0)