Re: Re: XML_CSSML, XML_XPath

From: Date: Mon, 10 Oct 2005 11:09:00 +0000
Subject: Re: Re: XML_CSSML, XML_XPath
References: 1 2 3 4 5 6  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-3112@lists.php.net to get a copy of this message
Auto reply after an IRC discussion: bertrand Gugger wrote:
Bonjour, Arnaud Limbourg wrote:
To be clearer it boils down to two choices: - add a dependency on PHP4, so it cannot be installed under PHP5 - add a warning telling people to update their script to use the factory method and remove the $this reassignment trick
I still believe it's possible to correct this bug for any PHP The trick could be done by adding a private property: $_theObj = null; if the constructor is called instead of the factory do:
           $this->_theObj = $this->factory($in_driver, $in_CSSML, $in_type, $in_params);
then correct all the methods in CSSML.php as: function load() {
       if ($this->_theObj) {
           return $this->_theObj->load();
       }
       if ($this->loaded) {
           return PEAR::raiseError(null, XML_CSSML_ALREADY_EXISTS, null, E_USER_WARNING, $this->CSSMLDoc, 'XML_CSSML_Error', true);
       }
} etc... my 2cts à+
Constructor should be (missed the &) $this->_theObj = & $this->factory($in_driver, $in_CSSML, $in_type, $in_params); Also the properties to reassign in this case: $this->loaded = &$this->_theObj->loaded; ... etc. This methods and properties "reassignments" should be done for all methods/properties inclusive what the drivers create. On this way, 100% BC is guaranted for the standard package. People customizing the drivers will have to use the "factory" This adaptation only takes place for users of the constructor, will make no difference (1 extra if () ) for the right "factory" users. If the cops here agree, I can do it, test it and commit it so the QA-team can release it. à+ -- bertrand "toggg" Gugger

« previous php.pear.qa (#3112) next »