Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4007 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74152 invoked from network); 15 Aug 2003 22:10:50 -0000 Received: from unknown (HELO www.lerdorf.com) (66.93.78.119) by pb1.pair.com with SMTP; 15 Aug 2003 22:10:50 -0000 Received: from rasmus2.corp.yahoo.com (rasmus2.corp.yahoo.com [207.126.232.175]) by www.lerdorf.com (8.12.9/8.12.9/Debian-5) with ESMTP id h7FMAkdP020608 for ; Fri, 15 Aug 2003 15:10:47 -0700 Date: Fri, 15 Aug 2003 15:10:45 -0700 (PDT) To: internals@lists.php.net Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Zend bug? Overloading API in PHP4 From: rasmus@lerdorf.com (Rasmus Lerdorf) Did the overloading API in PHP4 actually ever work? I have done some simple stuff with it in the past, but I tried using it for something real today and it is falling over. I have a very simple example extension which illustrates it. See http://lerdorf.com/ovl.tar.gz For the lazy, here is the meat of it. The problem is in my set function which looks like this: int _ovl_property_set(zend_property_reference *prop_ref, zval *value) { zend_llist_element *element = prop_ref->elements_list->head; zval overloaded_property = ((zend_overloaded_element *)(element->data))->element; zval_add_ref(&value); add_property_zval(prop_ref->object, Z_STRVAL(overloaded_property), value); return SUCCESS; } If I do: $obj->foo = array(1,2,3); Then the zval value that gets passed to my set function is messed up. If instead I do: $tmp = array(1,2,3); $obj->foo = $tmp; Then everything is fine. The http://lerdorf.com/ovl.tar.gz tarball has a full self-contained example of the problem if someone wouldn't mind having a look. -Rasmus