From:             ray dot paseur at gmail dot com
Operating system: Mac
PHP version:      5.3Git-2013-01-15 (snap)
Package:          SimpleXML related
Bug Type:         Bug
Bug description:foreach issues notice with main() link

Description:
------------
Foreach issues warning with link to
http://php.net/manual/en/function.main.php when iterating over SimpleXML
object.

Test script:
---------------
<?php // oop_bug_main.php
error_reporting(E_ALL);
echo "<pre>";
$xml = <<<XML
<category id='1' title='category 1'>
  <item id='a' title='item a' delete='true' />
  <item id='b' title='item b' delete='false'>B Stays</item>
</category>
XML;
$obj = SimpleXML_Load_string($xml);
$key = 0;
foreach ($obj->item as $item) {
    $attrs = $item->attributes();
    if ($attrs['delete'] == 'true') unset($obj->item[$key]);
    $key++;
}

Expected result:
----------------
No message about function main()

Actual result:
--------------
<pre><br />
<b>Warning</b>:  main() [<a href='function.main'>function.main</a>]: Node
no longer exists in <b>/Applications/MAMP/htdocs/oop_bug_main.php</b> on
line <b>12</b><br />


-- 
Edit bug report at https://bugs.php.net/bug.php?id=63993&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63993&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63993&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63993&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63993&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63993&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63993&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63993&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63993&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63993&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63993&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63993&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63993&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63993&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63993&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63993&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63993&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63993&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63993&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63993&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63993&r=mysqlcfg

Reply via email to