Skip to content

Instantly share code, notes, and snippets.

@jkuchar
Created May 28, 2017 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkuchar/42e850fb866bc0ce702e94435a2d42e5 to your computer and use it in GitHub Desktop.
Save jkuchar/42e850fb866bc0ce702e94435a2d42e5 to your computer and use it in GitHub Desktop.
SplFixedArray - infinite loop
<?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