We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code:
<?php $xml = "<root><a>1</a><a>2</a></root>"; $xml = simplexml_load_string($xml); $a = $xml->a; foreach ($a as $test) { var_dump((string) $a->current()); var_dump((string) $a); }
Resulted in this output: an infinite loop
But I expected this output instead:
string(1) "1" string(1) "1" string(1) "2" string(1) "1"
I think at least, because $a always refers to the first element implicitly, and only current points to the current iterated-over item?
This is basically the same as #12192, but triggered in a different yet similar way.
PHP 8.1+
Linux
The text was updated successfully, but these errors were encountered:
Fix phpGH-12208: SimpleXML infinite loop when a cast is used inside a…
961869f
… foreach
Merge branch 'PHP-8.1' into PHP-8.2
f4f34b6
* PHP-8.1: Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
486276f
Merge branch 'PHP-8.2' into PHP-8.3
673babe
* PHP-8.2: Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
Merge branch 'PHP-8.3'
7f0705b
* PHP-8.3: Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
Successfully merging a pull request may close this issue.
Description
The following code:
Resulted in this output:
an infinite loop
But I expected this output instead:
I think at least, because $a always refers to the first element implicitly, and only current points to the current iterated-over item?
This is basically the same as #12192, but triggered in a different yet similar way.
PHP Version
PHP 8.1+
Operating System
Linux
The text was updated successfully, but these errors were encountered: