/* {{{ xmlreader_write_property */ zval *xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot) { xmlreader_object *obj; zval tmp_member; xmlreader_prop_handler *hnd = NULL; if (Z_TYPE_P(member) != IS_STRING) { ZVAL_STR(&tmp_member, zval_get_string_func(member)); member = &tmp_member; } obj = Z_XMLREADER_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd != NULL) { php_error_docref(NULL, E_WARNING, "Cannot write to read-only property"); } else { value = zend_std_write_property(object, member, value, cache_slot); } if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } return value; }
/* {{{ xmlreader_read_property */ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) { xmlreader_object *obj; zval tmp_member; zval *retval = NULL; xmlreader_prop_handler *hnd = NULL; if (Z_TYPE_P(member) != IS_STRING) { ZVAL_STR(&tmp_member, zval_get_string_func(member)); member = &tmp_member; } obj = Z_XMLREADER_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd != NULL) { if (xmlreader_property_reader(obj, hnd, rv) == FAILURE) { retval = &EG(uninitialized_zval); } else { retval = rv; } } else { retval = zend_std_read_property(object, member, type, cache_slot, rv); } if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } return retval; }
/* {{{ xmlreader_get_property_ptr_ptr */ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) { xmlreader_object *obj; zval tmp_member; zval *retval = NULL; xmlreader_prop_handler *hnd = NULL; if (Z_TYPE_P(member) != IS_STRING) { ZVAL_STR(&tmp_member, zval_get_string_func(member)); member = &tmp_member; } obj = Z_XMLREADER_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd == NULL) { retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); } if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } return retval; }
/* {{{ mysqli_write_property */ zval *mysqli_write_property(zval *object, zval *member, zval *value, void **cache_slot) { zval tmp_member; mysqli_object *obj; mysqli_prop_handler *hnd = NULL; if (Z_TYPE_P(member) != IS_STRING) { ZVAL_STR(&tmp_member, zval_get_string_func(member)); member = &tmp_member; } obj = Z_MYSQLI_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd) { hnd->write_func(obj, value); } else { value = zend_std_write_property(object, member, value, cache_slot); } if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } return value; }
/* {{{ mysqli_read_property */ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) { zval tmp_member; zval *retval; mysqli_object *obj; mysqli_prop_handler *hnd = NULL; obj = Z_MYSQLI_P(object); if (Z_TYPE_P(member) != IS_STRING) { ZVAL_STR(&tmp_member, zval_get_string_func(member)); member = &tmp_member; } if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd) { retval = hnd->read_func(obj, rv); if (retval == NULL) { retval = &EG(uninitialized_zval); } } else { retval = zend_std_read_property(object, member, type, cache_slot, rv); } if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } return retval; }
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */ { if (Z_TYPE_P(expr) == IS_STRING) { return 0; } else { ZVAL_STR(expr_copy, zval_get_string_func(expr)); return 1; } }
static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /* {{{ */ { switch (Z_TYPE_P(expr)) { case IS_ARRAY: smart_str_appends(buf, "Array\n"); if (Z_REFCOUNTED_P(expr)) { if (Z_IS_RECURSIVE_P(expr)) { smart_str_appends(buf, " *RECURSION*"); return; } Z_PROTECT_RECURSION_P(expr); } print_hash(buf, Z_ARRVAL_P(expr), indent, 0); if (Z_REFCOUNTED_P(expr)) { Z_UNPROTECT_RECURSION_P(expr); } break; case IS_OBJECT: { HashTable *properties; int is_temp; zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr)); smart_str_appends(buf, ZSTR_VAL(class_name)); zend_string_release(class_name); smart_str_appends(buf, " Object\n"); if (Z_IS_RECURSIVE_P(expr)) { smart_str_appends(buf, " *RECURSION*"); return; } if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) { break; } Z_PROTECT_RECURSION_P(expr); print_hash(buf, properties, indent, 1); Z_UNPROTECT_RECURSION_P(expr); if (is_temp) { zend_hash_destroy(properties); FREE_HASHTABLE(properties); } break; } case IS_LONG: smart_str_append_long(buf, Z_LVAL_P(expr)); break; case IS_REFERENCE: zend_print_zval_r_to_buf(buf, Z_REFVAL_P(expr), indent); break; case IS_STRING: smart_str_append(buf, Z_STR_P(expr)); break; default: { zend_string *str = zval_get_string_func(expr); smart_str_append(buf, str); zend_string_release(str); } break; } }