Skip to content

Instantly share code, notes, and snippets.

@sun sun/bug.php
Last active Aug 29, 2015

What would you like to do?
SplDoublyLinkedList::IT_MODE_LIFO unsets wrong key
$list = new SplDoublyLinkedList();
// Comment this out to make it behave.
foreach ($list as $key => $value) {
if ($value === 'one') {
// Also note that 'two' gets re-keyed to 0 (but that seems to be expected behavior).
$expected = array('two');
echo "-- Actual result:\n", var_dump($list), "\n";
echo "-- Expected result:\n", var_dump($expected), "\n";
$ php bug.php
-- Actual result:
class SplDoublyLinkedList#1 (2) {
private $flags =>
private $dllist =>
array(1) {
[0] =>
string(3) "one"
-- Expected result:
array(1) {
[0] =>
string(3) "two"

This comment has been minimized.

Copy link
Owner Author

sun commented Jul 30, 2014

Related, but different:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.