summaryrefslogtreecommitdiff
path: root/ext/spl/spl_engine.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-11-04 06:44:29 -0800
committerXinchen Hui <laruence@gmail.com>2015-11-04 06:44:29 -0800
commite4ac4e75b5dbc39ed52ff998cb4f2053541ed2d8 (patch)
tree63c411b1db6b43eee36c3ebf068f3d72ab50a7bc /ext/spl/spl_engine.c
parentfe0af271c66260fedcb4b44fad85e18dd0dd0af6 (diff)
downloadphp-git-e4ac4e75b5dbc39ed52ff998cb4f2053541ed2d8.tar.gz
Fixed bug #70853 (SplFixedArray throws exception when using ref variable as index)
Diffstat (limited to 'ext/spl/spl_engine.c')
-rw-r--r--ext/spl/spl_engine.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index c9960d69ef..b3d1a3e9f5 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -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)) {
@@ -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);
}