Some places were checking for non-null get_properties, some weren't.
Make it clear that the handler is required and such checks are not
necessary.
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);
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);
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;
}
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);
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;
#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
}
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};
_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) {
|| ((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;
}