Re: Fix for XML_XPath breakage

From: Date: Tue, 12 Aug 2003 22:59:40 +0000
Subject: Re: Fix for XML_XPath breakage
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-19612@lists.php.net to get a copy of this message
"Joshua Eichorn" <jeichorn@joshuaeichorn.com> a écrit dans le message de news:3F394F74.7090506@joshuaeichorn.com... > I don't know if this has been reported before but XML_XPath 1.2 won't > load any files do to broken error handling. > > The fix is to lowercase DocDocument on line 148 > if (get_class($this->xml) == 'domdocument') { > > Also if your using this class and you run into methods that don't work > thats because it uses some of the new methods from CVS hopefully their > in the next php release. > -joshua eichorn It is true, get_class returns the class name in lowercase. Please report a bug at http://bugs.php.net > > Here is the patch: Index: XPath.php =================================================================== RCS file: /repository/pear/XML_XPath/XPath.php,v retrieving revision 1.16 diff -u -u -r1.16 XPath.php --- XPath.php 16 Jan 2003 19:10:51 -0000 1.16 +++ XPath.php 12 Aug 2003 22:58:51 -0000 @@ -126,7 +126,8 @@ // we need to capture errors, since there is not interface for this ob_start(); // in this case, we already have an xmldom object - if ($in_type == 'object' && get_class($in_xml) == 'DomDocument') { + // get_class returns a lowercase name + if ($in_type == 'object' && get_class($in_xml) == 'domdocument') { $this->xml = $in_xml; } // we can read the file, so use xmldocfile to make a xmldom object @@ -145,7 +146,8 @@ $loadError = ob_get_contents(); ob_end_clean(); // make sure a domxml object was created, and if so initialized the state - if (get_class($this->xml) == 'DomDocument') { + // get_class returns a lowercase name + if (get_class($this->xml) == 'domdocument') { $this->loaded = true; $this->ctx = $this->xml->xpath_new_context(); $this->pointer = $this->xml->root(); I need feedbacks before commiting.

« previous php.pear.dev (#19612) next »