summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-24 00:36:53 +0000
committerMarcus Boerger <helly@php.net>2003-08-24 00:36:53 +0000
commit38805f28098dcf7f27588c605eaba214ab044031 (patch)
tree8564b01c5a87892bee45f42316cd959182e24e5c /Zend/zend_API.c
parentb8799ff085b57288cabe49ddee7e1fe76a6eb8bb (diff)
downloadphp-git-38805f28098dcf7f27588c605eaba214ab044031.tar.gz
Add property read code and use that in default exception class
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index e25a111677..50a2ad1de9 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1738,6 +1738,23 @@ ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object,
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
+ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)
+{
+ zval property, *value;
+ zend_class_entry *old_scope = EG(scope);
+
+ EG(scope) = scope;
+
+ if (!Z_OBJ_HT_P(object)->read_property) {
+ zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", Z_OBJCE_P(object)->name, name);
+ }
+ ZVAL_STRINGL(&property, name, name_length, 0);
+ value = Z_OBJ_HT_P(object)->read_property(object, &property, silent TSRMLS_CC);
+
+ EG(scope) = old_scope;
+ return value;
+}
+
/*
* Local variables:
* tab-width: 4