Created
May 28, 2017 16:06
-
-
Save jkuchar/42e850fb866bc0ce702e94435a2d42e5 to your computer and use it in GitHub Desktop.
SplFixedArray - infinite loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://3v4l.org/LDQ6i | |
// Arrange | |
$object = new SplFixedArray(2); | |
$object[0] = 'first-value'; | |
$object[1] = 'second-value'; | |
// Act | |
foreach ($object as $key1 => $val1) { | |
foreach ($object as $key2 => $val2) { | |
break; | |
} | |
} | |
// Assert | |
// Will never execute... | |
echo "Hello World!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment