Bug #63993 [Nab]: foreach issues notice with main() link
| From: | ray dot paseur at gmail dot com | Date: | Wed, 16 Jan 2013 10:32:47 +0000 |
| Subject: | Bug #63993 [Nab]: foreach issues notice with main() link | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176053@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
User updated by: ray dot paseur at gmail dot com
Reported by: ray dot paseur at gmail dot com
Summary: foreach issues notice with main() link
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:
"this main means it's at the top scope..."
What does that mean, in plain language, please? The script fails, and it issues a warning message
that refers the client to a page that says, "If you discover such a reference, please » file
a bug report, indicating the PHP function caused the error that linked to main() and it will be
fixed and properly documented."
I'd be grateful for your help, thanks.
Previous Comments:
------------------------------------------------------------------------
[2013-01-16 03:07:25] laruence@php.net
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...
------------------------------------------------------------------------
[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