summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorHarald Radi <phanto@php.net>2002-04-22 14:22:27 +0000
committerHarald Radi <phanto@php.net>2002-04-22 14:22:27 +0000
commit6ac6cb1040c6ccf1157cf8d8384be1cb074c9281 (patch)
tree5714c26e375f3c3adaa32ac893552c0f85a970da /Zend/zend_API.c
parent6c491a565487f2219575f9d55e1cebf4f0b46654 (diff)
downloadphp-git-6ac6cb1040c6ccf1157cf8d8384be1cb074c9281.tar.gz
added get_class_entry callback handler to the
object handlers structure
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 26ee2ce77d..6efa0ff214 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -198,6 +198,25 @@ ZEND_API char *zend_zval_type_name(zval *arg)
}
}
+ZEND_API zend_class_entry **zend_get_class_entry(zval *zobject)
+{
+ zend_class_entry **ce;
+
+ if (Z_OBJ_HT_P(zobject)->get_class_entry) {
+ TSRMLS_FETCH();
+ ce = Z_OBJ_HT_P(zobject)->get_class_entry(zobject TSRMLS_CC);
+ } else {
+ if(!IS_ZEND_STD_OBJECT(*zobject)) {
+ zend_error(E_ERROR, "Class entry required for an object without class");
+ return NULL;
+ }
+
+ ce = &(Z_OBJ_P(zobject)->ce);
+ }
+
+ return ce;
+}
+
static int zend_check_class(zval *obj, zend_class_entry *expected_ce)
{
zend_class_entry *ce;
@@ -206,16 +225,12 @@ static int zend_check_class(zval *obj, zend_class_entry *expected_ce)
return 0;
}
- /* TBI!! new object handlers */
- if(!IS_ZEND_STD_OBJECT(*obj)) {
- return 0;
- }
-
for (ce = Z_OBJCE_P(obj); ce != NULL; ce = ce->parent) {
if (ce == expected_ce) {
return 1;
}
}
+
return 0;
}
@@ -402,7 +417,7 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec)
{
zval **p = va_arg(*va, zval **);
zend_class_entry *ce = va_arg(*va, zend_class_entry *);
- if (Z_TYPE_PP(arg) != IS_OBJECT || !zend_check_class(*arg, ce)) {
+ if (!zend_check_class(*arg, ce)) {
if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
*p = NULL;
} else {