Exemple #1
0
/* {{{ 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;
}
Exemple #2
0
/* {{{ 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;
	zend_object_handlers *std_hnd;

 	if (Z_TYPE_P(member) != IS_STRING) {
		tmp_member = *member;
		zval_copy_ctor(&tmp_member);
		convert_to_string(&tmp_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 {
		std_hnd = zend_get_std_object_handlers();
		retval = std_hnd->read_property(object, member, type, cache_slot, rv);
	}

	if (member == &tmp_member) {
		zval_dtor(member);
	}
	return retval;
}