summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2002-02-07 14:08:43 +0000
committerStanislav Malyshev <stas@php.net>2002-02-07 14:08:43 +0000
commit6608f07322789bd0896b265c29e13c0c9f5d5898 (patch)
tree3149fb62b09cbea8d328df4d930e4cddb99aef03 /Zend/zend_API.c
parent5e9b1634c68dc70bbc6480fddb303d8807a943d2 (diff)
downloadphp-git-6608f07322789bd0896b265c29e13c0c9f5d5898.tar.gz
Mega-commit: Enter the new object model
Note: only standard Zend objects are working now. This is definitely going to break custom objects like COM, Java, etc. - this will be fixed later. Also, this may break other things that access objects' internals directly.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 3144f31cf2..b1707f595b 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -206,6 +206,11 @@ 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;
@@ -577,15 +582,18 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type
}
arg->type = IS_OBJECT;
- arg->value.obj = zend_objects_new(&object, class_type);
-
- if (properties) {
- object->properties = properties;
+ if(class_type->create_object == NULL) {
+ arg->value.obj = zend_objects_new(&object, class_type);
+ if (properties) {
+ object->properties = properties;
+ } else {
+ ALLOC_HASHTABLE_REL(object->properties);
+ zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+ }
} else {
- ALLOC_HASHTABLE_REL(object->properties);
- zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
- zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
- }
+ arg->value.obj = class_type->create_object(class_type);
+ }
return SUCCESS;
}
@@ -1344,7 +1352,7 @@ zend_bool zend_is_callable(zval *callable, zend_bool syntax_only, char **callabl
zend_hash_find(EG(class_table), lcname, Z_STRLEN_PP(obj) + 1, (void**)&ce);
efree(lcname);
} else {
- ce = Z_OBJCE_PP(obj);
+ ce = Z_OBJCE_PP(obj); /* ??? */
if (callable_name) {
char *ptr;