Re: [PHP3] Re: [PHP4BETA] Re: [PHP3] OO

From: Date: Sat, 07 Aug 1999 04:42:32 +0000
Subject: Re: [PHP3] Re: [PHP4BETA] Re: [PHP3] OO
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-3193@lists.php.net to get a copy of this message
Hello Zeev, On 05-Aug-99 05:19:55, you wrote: >At 01:32 05/08/99 , Manuel Lemos wrote: >>There is no mention in the documentation about being able to register more >>than one shut down function. Does that work like that in PHP 3 too? >Yes, it always has. Maybe the documentation needs to be more explict there. >>For instance, a destructor could close a file geting the identifier from a >>instance variable and would set to 0 to prevent closing it again: >> >>class some_class >>{ >> $file=0; >> >> Function Destructor() >> { >> if($this->file) >> { >> fclose($this->file); >> $this->file=0; >> } >> } >> >> ... >>} >Not really. The problem doesn't occur when you have multiple variables >pointing at the same zval (pval) value - in that case, we can easily rely >on Zend's reference counting to call the destructor only when the last >reference is deleted. The problem occurs when there are actually multiple >zval's that contain the data of the same object (they contain the class >type and the properties - but changing one will not change the other, and, >they don't have their resources doubled - they point at the same resources >(e.g. file handles)). I'm afraid I don't quite follow what you mean, maybe because I'm not sure what exactly is zval. Is zval a class pointer or a instance pointer? If you have multiple objects of the same class, shouldn't only there be only one zval for each object? >>Great. BTW, couldn't you add a similar support to XML call functions. You >>could have something like xml_set_handler_object($parser,$object) and then >>instead of calling global functions the handlers would call the object >>methods. >No idea what xml_set_handler_object() is, but I assume that once I It's a name suggested for a function that would set the object with functions that would be called as xml call back handlers. >demonstrate how to do it with register_shutdown_function(), people will >easily follow with other examples. I guess you mean that it would have to be the maintainer of the XML support module (Stig?) to learn how to do that from your register_shutdown_function example and add such kind of support, right? Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.version4 (#3193) next »