Bug #63993 [Opn->Nab]: foreach issues notice with main() link
| From: | laruence@php.net | Date: | Wed, 16 Jan 2013 03:07:25 +0000 |
| Subject: | Bug #63993 [Opn->Nab]: foreach issues notice with main() link | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176046@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63993&edit=1
ID: 63993
Updated by: laruence@php.net
Reported by: ray dot paseur at gmail dot com
Summary: foreach issues notice with main() link
-Status: Open
+Status: Not a bug
Type: Bug
Package: SimpleXML related
Operating System: Mac
PHP Version: 5.3Git-2013-01-15 (snap)
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
this main means it's at the top scope...
Previous Comments:
------------------------------------------------------------------------
[2013-01-15 18:04:31] ray dot paseur at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=63993&edit=1