@@ -51,7 +51,7 @@ public function offsetSet($index, $value)
5151 if ($ index === null ) {
5252 $ this ->list [] = $ value ;
5353
54- } elseif ($ index < 0 || $ index >= count ($ this ->list )) {
54+ } elseif (! is_int ( $ index ) || $ index < 0 || $ index >= count ($ this ->list )) {
5555 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
5656
5757 } else {
@@ -68,7 +68,7 @@ public function offsetSet($index, $value)
6868 */
6969 public function offsetGet ($ index )
7070 {
71- if ($ index < 0 || $ index >= count ($ this ->list )) {
71+ if (! is_int ( $ index ) || $ index < 0 || $ index >= count ($ this ->list )) {
7272 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
7373 }
7474 return $ this ->list [(int ) $ index ];
@@ -81,7 +81,7 @@ public function offsetGet($index)
8181 */
8282 public function offsetExists ($ index ): bool
8383 {
84- return $ index >= 0 && $ index < count ($ this ->list );
84+ return is_int ( $ index ) && $ index >= 0 && $ index < count ($ this ->list );
8585 }
8686
8787
@@ -93,7 +93,7 @@ public function offsetExists($index): bool
9393 */
9494 public function offsetUnset ($ index )
9595 {
96- if ($ index < 0 || $ index >= count ($ this ->list )) {
96+ if (! is_int ( $ index ) || $ index < 0 || $ index >= count ($ this ->list )) {
9797 throw new Nette \OutOfRangeException ('Offset invalid or out of range ' );
9898 }
9999 array_splice ($ this ->list , (int ) $ index , 1 );
0 commit comments