Skip to content

Commit

Permalink
Merge branch 'PHP-7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
laruence committed Nov 4, 2015
2 parents 5385478 + e4ac4e7 commit d598e1b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/spl/spl_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ PHPAPI zend_long spl_offset_convert_to_long(zval *offset) /* {{{ */
{
zend_ulong idx;

try_again:
switch (Z_TYPE_P(offset)) {
case IS_STRING:
if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), idx)) {
Expand All @@ -56,6 +57,9 @@ PHPAPI zend_long spl_offset_convert_to_long(zval *offset) /* {{{ */
return 0;
case IS_TRUE:
return 1;
case IS_REFERENCE:
offset = Z_REFVAL_P(offset);
goto try_again;
case IS_RESOURCE:
return Z_RES_HANDLE_P(offset);
}
Expand Down
15 changes: 15 additions & 0 deletions ext/spl/tests/bug70853.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
Bug #70853 (SplFixedArray throws exception when using ref variable as index)
--FILE--
<?php

$list = new SplFixedArray(10);
$ndx = 1;
$ndx2 =& $ndx;
$list[$ndx] = 123; // This throws an exception;
$list[$ndx2] = 123; // as does this, to.
echo 'ok';

?>
--EXPECT--
ok

0 comments on commit d598e1b

Please sign in to comment.