]> granicus.if.org Git - php/commitdiff
As discussed with Andi, add this helper API for setting the object pointer from
authorWez Furlong <wez@php.net>
Mon, 17 May 2004 11:27:16 +0000 (11:27 +0000)
committerWez Furlong <wez@php.net>
Mon, 17 May 2004 11:27:16 +0000 (11:27 +0000)
within the constructor.

Please read the comment for notes about how to use it; in general, you don't
need it, so don't use it.

Zend/zend_objects_API.c
Zend/zend_objects_API.h

index 95a36a178184a7aed9b2698bee3b1574e97b59cb..69a33b525bbc2966eb47a30c9f18fc941179373a 100644 (file)
@@ -190,6 +190,20 @@ ZEND_API void *zend_object_store_get_object(zval *zobject TSRMLS_DC)
        return EG(objects_store).object_buckets[handle].bucket.obj.object;
 }
 
+/* zend_object_store_set_object:
+ * It is ONLY valid to call this function from within the constructor of an
+ * overloaded object.  Its purpose is to set the object pointer for the object
+ * when you can't possibly know its value until you have parsed the arguments
+ * from the constructor function.  You MUST NOT use this function for any other
+ * weird games, or call it at any other time after the object is constructed.
+ * */
+ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC)
+{
+       zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
+
+       EG(objects_store).object_buckets[handle].bucket.obj.object = object;
+}
+
 
 /* Proxy objects workings */
 typedef struct _zend_proxy_object {
index 469fb6a5d1cdac267afc74d0d55e79a5e761904b..cfe9d3a6620b1f094e89d75bd90147eb13d2082d 100644 (file)
@@ -67,6 +67,9 @@ ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
 ZEND_API void zend_objects_store_delete_obj(zval *object TSRMLS_DC);
 ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
 ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
+/* See comment in zend_objects_API.c before you use this */
+ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
+
 ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects TSRMLS_DC);
 
 #define ZEND_OBJECTS_STORE_HANDLERS zend_objects_store_add_ref, zend_objects_store_del_ref, zend_objects_store_clone_obj