php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34140 Bug # 28444 is back again in 5.0.4
Submitted: 2005-08-15 22:07 UTC Modified: 2005-08-23 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gary at garycarr dot net Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.0.4 OS: Linux
Private report: No CVE-ID: None
 [2005-08-15 22:07 UTC] gary at garycarr dot net
Description:
------------
bug #28444 is back again, it was fixed in 5.0.3, but now is back again in 5.0.4. This is a duplicate bug, but it has been fixed and now is problem again, resubmitting for that reason.



Reproduce code:
---------------
$query = '//menus';
$nodelist = $xpath->query($query);
if (isset($nodelist)) {
  foreach ($nodelist as $node){
    if ($node->hasAttributes()){
      foreach ($node->attributes as $attribute) {
        echo nl2br(print_r($attribute,true));
      }
    }
  }
}

Expected result:
----------------
the details of each $attribute;


Actual result:
--------------
PHP Error "Cannot access undefined property for object with overloaded property access" on foreach line...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-15 22:10 UTC] tony2001@php.net
#28444 was fixed exactly in *5.0.4*.
Please provide a short but complete reproduce script that doesn't require any external resources. It would be good if the script would fit in max 20 lines. 
 [2005-08-15 22:34 UTC] gary at garycarr dot net
ok here is the complete test code :


$xml='<?xml version="1.0" encoding = "UTF-8"?><menus name="Toolbar"><menu id="1" name="about"><text>Learn more about our company</text><icon>about.gif</icon></menu></menus>';
$domdoc = new domDocument;
$domdoc->loadxml($xml);
$xpath = new domXPath($domdoc);
$query = '//menus/menu';
$nodelist = $xpath->query($query);
if (isset($nodelist)) {
  foreach ($nodelist as $node){
    if ($node->hasAttributes()){
      foreach ($node->attributes as $attribute) {
        echo nl2br("$attribute->name = $attribute->value\n");
      }
    }
  }
}
 [2005-08-15 22:39 UTC] tony2001@php.net
This code works fine with:
5.0.3
5.0.4
5.1-dev
6.0-dev
(I get "id = 1<br /> name = about<br />" in all cases)
Are you sure you've posted the right code?
 [2005-08-15 22:55 UTC] gary at garycarr dot net
ok thx Tony, we will recompile our 5.0.4 release and try it again.  The exact code that we got the error with is a little more involved than this code, but I gave you a small snippet that is very similar, we will recompile and run this script and see what our results are.  I will update ASAP.
 [2005-08-15 22:58 UTC] tony2001@php.net
Ok, marking as waiting for feedback until you're ready to provide a real reproduce case.
 [2005-08-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC