-
Bug
-
Resolution: Cannot Reproduce
-
Minor
-
None
-
2.6.3
-
MOODLE_26_STABLE
-
csvan_foreach_semantics
-
-
BACKEND Sprint 18
The following snippet contains reference semantics on an iterator in a foreach loop:
https://github.com/moodle/moodle/blob/MOODLE_26_STABLE/lib/navigationlib.php#L869
As of PHP 5.2, this is not legitimate code, and should throw an exception, which it also does using another PHP implementation such as HHVM:
"Fatal error: An iterator cannot be used with foreach by reference in /***/lib/navigationlib.php on line 879"
That it does not do so under the Zend implemenation is perhaps due to a bug. Another possibility is that the $node variable in the snippet (seemingly) never gets assigned, and hence the exception is dodged under Zend. In either case, this should most likely be changed to avoid breakage if these rules are ever enforced in 5.2+ runtimes.
EDIT: There are other examples where the iterator is clearly being assigned, and yet no error is signalled. Almost certainly a bug in Zend.
- will help resolve
-
MDL-43724 Hiphop (hhvm) support in Moodle
-
- Closed
-