php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26976 I can't read pass level one of an array
Submitted: 2004-01-20 07:13 UTC Modified: 2004-01-21 15:18 UTC
From: dylan dot egan at optusnet dot com dot au Assigned:
Status: Closed Package: XML related
PHP Version: 5CVS-2004-01-20 (dev) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dylan dot egan at optusnet dot com dot au
New email:
PHP Version: OS:

 

 [2004-01-20 07:13 UTC] dylan dot egan at optusnet dot com dot au
Description:
------------
Trying to read through a parsed XML file with simpleXML, but I can't go past the 2nd level of the array.

Reproduce code:
---------------
www.ircphp.com/157
   

Expected result:
----------------
Read --OUTPUT--


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-20 20:10 UTC] sniper@php.net
Here's simple test:
-----------------------------------------------------------
--TEST--
Bug #26976 (Can not access array elements using index)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?>
--FILE--
<?php

$root = simplexml_load_string(
'<?xml version="1.0"?>
<root>
 <child>a</child>
 <child>b</child>
 <child>c</child>
 <child>d</child>
</root>
');

echo $root->child[0], "\n";
echo $root->child[1], "\n";
echo $root->child[2], "\n";
echo $root->child[3], "\n";

?>
--EXPECT--
a
b
c
d
-----------------------------------------------------------

I get this output:

a
b
b
b

(foreach works fine though :)

 [2004-01-21 06:28 UTC] rrichards@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 22:01:36 2025 UTC