summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend.c6
-rw-r--r--Zend/zend_builtin_functions.c5
-rw-r--r--Zend/zend_object_handlers.c4
-rw-r--r--Zend/zend_object_handlers.h2
-rw-r--r--Zend/zend_types.h2
-rw-r--r--ext/reflection/php_reflection.c6
6 files changed, 8 insertions, 17 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 6a53e60aa1..ee88afed02 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -389,7 +389,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
break;
case IS_OBJECT:
{
- HashTable *properties = NULL;
+ HashTable *properties;
zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
zend_printf("%s Object (", ZSTR_VAL(class_name));
zend_string_release_ex(class_name, 0);
@@ -399,9 +399,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
return;
}
- if (Z_OBJ_HANDLER_P(expr, get_properties)) {
- properties = Z_OBJPROP_P(expr);
- }
+ properties = Z_OBJPROP_P(expr);
if (properties) {
Z_PROTECT_RECURSION_P(expr);
print_flat_hash(properties);
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 586b9d4e7f..f68388cd20 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1174,12 +1174,7 @@ ZEND_FUNCTION(get_object_vars)
Z_PARAM_OBJECT(obj)
ZEND_PARSE_PARAMETERS_END();
- if (Z_OBJ_HT_P(obj)->get_properties == NULL) {
- RETURN_FALSE;
- }
-
properties = Z_OBJ_HT_P(obj)->get_properties(obj);
-
if (properties == NULL) {
RETURN_FALSE;
}
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index f56913cbe8..96395a7554 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -145,9 +145,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ *
if (!ce->__debugInfo) {
*is_temp = 0;
- return Z_OBJ_HANDLER_P(object, get_properties)
- ? Z_OBJ_HANDLER_P(object, get_properties)(object)
- : NULL;
+ return Z_OBJ_HANDLER_P(object, get_properties)(object);
}
zend_call_method_with_0_params(object, ce, &ce->__debugInfo, ZEND_DEBUGINFO_FUNC_NAME, &retval);
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 9437aaaf76..094489a80c 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -147,7 +147,7 @@ struct _zend_object_handlers {
zend_object_unset_property_t unset_property;
zend_object_has_dimension_t has_dimension;
zend_object_unset_dimension_t unset_dimension;
- zend_object_get_properties_t get_properties;
+ zend_object_get_properties_t get_properties; /* required */
zend_object_get_method_t get_method;
zend_object_call_method_t call_method;
zend_object_get_constructor_t get_constructor;
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 64f8dee295..2e773df6e9 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -670,7 +670,7 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval))
#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*(zval_p))
-#define Z_OBJDEBUG(zval,tmp) (Z_OBJ_HANDLER((zval),get_debug_info)?Z_OBJ_HANDLER((zval),get_debug_info)(&(zval),&tmp):(tmp=0,Z_OBJ_HANDLER((zval),get_properties)?Z_OBJPROP(zval):NULL))
+#define Z_OBJDEBUG(zval,tmp) (Z_OBJ_HANDLER((zval),get_debug_info)?Z_OBJ_HANDLER((zval),get_debug_info)(&(zval),&tmp):(tmp=0,Z_OBJPROP(zval)))
#define Z_OBJDEBUG_P(zval_p,tmp) Z_OBJDEBUG(*(zval_p), tmp)
#define Z_RES(zval) (zval).value.res
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 4838b5cebc..8114625e68 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -434,7 +434,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
}
smart_str_append_printf(str, "%s }\n", indent);
- if (obj && Z_TYPE_P(obj) == IS_OBJECT && Z_OBJ_HT_P(obj)->get_properties) {
+ if (obj && Z_TYPE_P(obj) == IS_OBJECT) {
HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj);
zend_string *prop_name;
smart_str prop_str = {0};
@@ -4322,7 +4322,7 @@ ZEND_METHOD(reflection_class, getProperties)
_addproperty(prop_info, key, ce, return_value, filter);
} ZEND_HASH_FOREACH_END();
- if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0 && Z_OBJ_HT(intern->obj)->get_properties) {
+ if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) {
HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj);
zval *prop;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
@@ -5227,7 +5227,7 @@ ZEND_METHOD(reflection_property, __construct)
|| ((property_info->flags & ZEND_ACC_PRIVATE)
&& property_info->ce != ce)) {
/* Check for dynamic properties */
- if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT && Z_OBJ_HT_P(classname)->get_properties) {
+ if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) {
if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) {
dynam_prop = 1;
}