php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24559 XML_Xpath class has several showstopper bugs
Submitted: 2003-07-09 05:55 UTC Modified: 2003-08-12 18:38 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: lsmith@php.net Assigned: dallen (profile)
Status: Closed Package: PEAR related
PHP Version: Irrelevant OS: Win2k
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 + 21 = ?
Subscribe to this entry?

 
 [2003-07-09 05:55 UTC] lsmith@php.net
Description:
------------
There are several bugs related to comparing a calls to get_class with a mixed case string (get_class always returns lower case strings):
get_class($in_xml) == 'DomDocument'

Furthermore the examples do not work.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-31 04:12 UTC] nicos@php.net
Can anyone take a look at this fix?

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   31 Jul 2003 09:11:40 -0000
@@ -126,7 +126,7 @@
         // 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') {
+        if ($in_type == 'object' && strtolower(get_class($in_xml)) == 'domdocument') {
             $this->xml = $in_xml;
         }
         // we can read the file, so use xmldocfile to make a xmldom object
@@ -145,7 +145,7 @@
         $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') {
+        if (strtolower(get_class($this->xml)) == 'domdocument') {
             $this->loaded = true;
             $this->ctx = $this->xml->xpath_new_context();
             $this->pointer = $this->xml->root();

 [2003-08-12 18:38 UTC] nicos@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 09:03:33 2022 UTC