|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-09-28 03:05 UTC] laruence@php.net
[2012-09-28 03:05 UTC] laruence@php.net
-Type: Bug
+Type: Feature/Change Request
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
Description: ------------ The setIteratorMode method seems to cut everything above 3 (IT_MODE_LIFO | IT_MODE_DELETE) to 0. This is most unfortunate, because one can not define any user flags. For example I can't do anything of sort: <?php class MyList extends SplDoublyLinkedList { const IT_MODE_PLUS_ONE = 512; public function current() { $val = parent::current(); if ( 0 != $this->getIteratorMode() & self::IT_MODE_PLUS_ONE ) { return $val + 1; } return $val; } } $List = new MyList(); $List->setIteratorMode( $List->getIteratorMode() | MyList::IT_MODE_PLUS_ONE ); $List->push(5); $List->push(6); foreach ( $List as $value ) { echo "{$value}\n"; } ?> Test script: --------------- $Sl = new SplStack(); $Sl->setIteratorMode(3); var_dump($Sl->getIteratorMode()); $Sl->setIteratorMode(4); var_dump($Sl->getIteratorMode()); Expected result: ---------------- setIteratorMode should accept any provided integer Actual result: -------------- the mode is stripped down to 0 if provided integer is greater then 3