From:             rockerboo at gmail dot com
Operating system: CentOS 5
PHP version:      5.2.4
PHP Bug Type:     SimpleXML related
Bug description:  Method variable array's missing

Description:
------------
I create an SimpleXmlElement, and see if one of the member variable
array's in an array, and it says it is not. But I am able to foreach
through the array, and when I do, the key states they 2nd parent's key as
the key. 

Linux virbdevel.com 2.6.18-8.1.4.el5.028stab035.1 #1 SMP Sat Jun 9
01:43:20 MSD 2007 i686

'./configure' '--with-apxs2=/usr/sbin/apxs' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--libdir=/usr/lib'
'--with-libdir=lib' '--with-mysql' '--with-mysqli' '--with-pear'
'--with-zlib' '--with-openssl' '--with-png' '--with-jpeg-dir=/usr/lib'
'--with-bz2' '--enable-bcmath' '--enable-exif' '--with-fam' '--with-gd'
'--enable-gd-native-ttf' '--with-freetype-dir=/usr/lib'
'--enable-gd-jis-conv' '--with-imap' '--with-imap-ssl' '--enable-mbstring'
'--with-iconv' '--with-mcrypt' '--enable-shmop' '--enable-imap'
'--enable-imap-ssl' '--with-kerberos' '--with-xsl' '--with-dom'
'--enable-soap' '--enable-simplexml' '--with-mhash' '--with-curl'
'--enable-calendar' '--enable-dbx' '--with-xml' '--enable-sysvsem'
'--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars'
'--enable-trans-sid' '--enable-sockets' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--disable-ffmpeg'

Reproduce code:
---------------
http://pastebin.com/f252f4872

Expected result:
----------------
    
SimpleXMLElement Object
(
    [EMAIL PROTECTED] => Array
        (
            [type] => array
        )

    [status] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 18:06:54 +0000 2007
                    [id] => 249403592
                    [text] => Everyone that gets the new iPod Touch
automatically receives a iPhone Wannabe t-shirt and decal.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 18:02:46 +0000 2007
                    [id] => 249393302
                    [text] => iPodTouch? No. iPodBadTouch. Don't touch
your iPod that way.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [2] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 17:10:46 +0000 2007
                    [id] => 249255522
                    [text] => Dear coffee, I forgot to say hi this
morning. Apple event is kicking off. Expect more neglect.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [3] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 01:44:00 +0000 2007
                    [id] => 247693942
                    [text] => If the Hood blimp ever crashed (upside
down), it would say pooH. Just a random epiphony.
                    [source] => txt
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [4] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 00:25:31 +0000 2007
                    [id] => 247569882
                    [text] => Working way too late. Must. leave. now. In
happier news, Simmy and I put the wraps on the Noob Tee Store. More
tomorrow.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

        )

)
is_array($sxe->status): false
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 18:06:54 +0000 2007
    [id] => 249403592
    [text] => Everyone that gets the new iPod Touch automatically receives
a iPhone Wannabe t-shirt and decal.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
0
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 18:06:54 +0000 2007
    [id] => 249403592
    [text] => Everyone that gets the new iPod Touch automatically receives
a iPhone Wannabe t-shirt and decal.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
1
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 18:02:46 +0000 2007
    [id] => 249393302
    [text] => iPodTouch? No. iPodBadTouch. Don't touch your iPod that
way.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
2
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 17:10:46 +0000 2007
    [id] => 249255522
    [text] => Dear coffee, I forgot to say hi this morning. Apple event is
kicking off. Expect more neglect.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
3
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 01:44:00 +0000 2007
    [id] => 247693942
    [text] => If the Hood blimp ever crashed (upside down), it would say
pooH. Just a random epiphony.
    [source] => txt
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
4
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 00:25:31 +0000 2007
    [id] => 247569882
    [text] => Working way too late. Must. leave. now. In happier news,
Simmy and I put the wraps on the Noob Tee Store. More tomorrow.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)

------------------------------------------------------------------------------------------

is_array($status): true
Array
(
    [0] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [1] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [2] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [3] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [4] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

)
0
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
1
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
2
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
3
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
4
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)


Actual result:
--------------
SimpleXMLElement Object
(
    [EMAIL PROTECTED] => Array
        (
            [type] => array
        )

    [status] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 18:06:54 +0000 2007
                    [id] => 249403592
                    [text] => Everyone that gets the new iPod Touch
automatically receives a iPhone Wannabe t-shirt and decal.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 18:02:46 +0000 2007
                    [id] => 249393302
                    [text] => iPodTouch? No. iPodBadTouch. Don't touch
your iPod that way.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [2] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 17:10:46 +0000 2007
                    [id] => 249255522
                    [text] => Dear coffee, I forgot to say hi this
morning. Apple event is kicking off. Expect more neglect.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [3] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 01:44:00 +0000 2007
                    [id] => 247693942
                    [text] => If the Hood blimp ever crashed (upside
down), it would say pooH. Just a random epiphony.
                    [source] => txt
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

            [4] => SimpleXMLElement Object
                (
                    [created_at] => Wed Sep 05 00:25:31 +0000 2007
                    [id] => 247569882
                    [text] => Working way too late. Must. leave. now. In
happier news, Simmy and I put the wraps on the Noob Tee Store. More
tomorrow.
                    [source] => twitterrific
                    [user] => SimpleXMLElement Object
                        (
                            [id] => 5871202
                            [name] => Brad
                            [screen_name] => stillframe
                            [location] => Boston, USA
                            [description] => drunk and in jail for arson
                            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
                            [url] => http://stillframe.com
                            [protected] => false
                        )

                )

        )

)
is_array($sxe->status): false
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 18:06:54 +0000 2007
    [id] => 249403592
    [text] => Everyone that gets the new iPod Touch automatically receives
a iPhone Wannabe t-shirt and decal.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
status
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 18:06:54 +0000 2007
    [id] => 249403592
    [text] => Everyone that gets the new iPod Touch automatically receives
a iPhone Wannabe t-shirt and decal.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
status
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 18:02:46 +0000 2007
    [id] => 249393302
    [text] => iPodTouch? No. iPodBadTouch. Don't touch your iPod that
way.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
status
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 17:10:46 +0000 2007
    [id] => 249255522
    [text] => Dear coffee, I forgot to say hi this morning. Apple event is
kicking off. Expect more neglect.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
status
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 01:44:00 +0000 2007
    [id] => 247693942
    [text] => If the Hood blimp ever crashed (upside down), it would say
pooH. Just a random epiphony.
    [source] => txt
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)
status
SimpleXMLElement Object
(
    [created_at] => Wed Sep 05 00:25:31 +0000 2007
    [id] => 247569882
    [text] => Working way too late. Must. leave. now. In happier news,
Simmy and I put the wraps on the Noob Tee Store. More tomorrow.
    [source] => twitterrific
    [user] => SimpleXMLElement Object
        (
            [id] => 5871202
            [name] => Brad
            [screen_name] => stillframe
            [location] => Boston, USA
            [description] => drunk and in jail for arson
            [profile_image_url] =>
http://assets1.twitter.com/system/user/profile_image/5871202/normal/noobbrad_x150.jpg?1187756051
            [url] => http://stillframe.com
            [protected] => false
        )

)

------------------------------------------------------------------------------------------

is_array($status): true
Array
(
    [0] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [1] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [2] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [3] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

    [4] => fubble Object
        (
            [var1] => whatever
            [var2] => whatever2
            [var3] => whatever3
            [var4] => whatever4
            [var5] => whatever5
        )

)
0
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
1
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
2
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
3
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)
4
fubble Object
(
    [var1] => whatever
    [var2] => whatever2
    [var3] => whatever3
    [var4] => whatever4
    [var5] => whatever5
)

-- 
Edit bug report at http://bugs.php.net/?id=42571&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42571&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42571&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42571&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42571&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42571&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42571&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42571&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42571&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42571&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42571&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42571&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42571&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42571&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42571&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42571&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42571&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42571&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42571&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42571&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42571&r=mysqlcfg

Reply via email to