From 42fbc76d9cee94241e56c82a8550ee6221d0f239 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 10 Feb 2020 11:05:26 +0100 Subject: Always invoke zpp in ReflectionProperty::getValue/isInitialized Make sure we still perform a zpp check for the static case, and also always enforce that the parameter is ?object. Otherwise we violate the specified signature. --- ext/reflection/php_reflection.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6fb415f2ad..95c4859e94 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -5467,9 +5467,13 @@ ZEND_METHOD(reflection_property, getValue) { reflection_object *intern; property_reference *ref; - zval *object, *name; + zval *object = NULL, *name; zval *member_p = NULL; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &object) == FAILURE) { + RETURN_THROWS(); + } + GET_REFLECTION_OBJECT_PTR(ref); if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { @@ -5487,7 +5491,8 @@ ZEND_METHOD(reflection_property, getValue) } else { zval rv; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) { + if (!object) { + zend_type_error("No object provided for getValue() on instance property"); RETURN_THROWS(); } @@ -5553,9 +5558,13 @@ ZEND_METHOD(reflection_property, isInitialized) { reflection_object *intern; property_reference *ref; - zval *object, *name; + zval *object = NULL, *name; zval *member_p = NULL; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &object) == FAILURE) { + RETURN_THROWS(); + } + GET_REFLECTION_OBJECT_PTR(ref); if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) { @@ -5575,7 +5584,8 @@ ZEND_METHOD(reflection_property, isInitialized) zend_class_entry *old_scope; int retval; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) { + if (!object) { + zend_type_error("No object provided for isInitialized() on instance property"); RETURN_THROWS(); } -- cgit v1.2.1