From: Dmitry Stogov Date: Wed, 9 Apr 2014 18:31:40 +0000 (+0400) Subject: Fixed resource to integer conversion X-Git-Tag: POST_PHPNG_MERGE~412^2~137 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a938b2460723f609a6524e8e91058985fdc2a897;p=php Fixed resource to integer conversion --- diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index ae817a0b8a..3bd4b3df31 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -360,15 +360,16 @@ fetch_dim_string: } return retval; case IS_RESOURCE: - zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(offset), Z_LVAL_P(offset)); + zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle); + index = Z_RES_P(offset)->handle; + goto num_index; case IS_DOUBLE: + index = (long)Z_DVAL_P(offset); + goto num_index; case IS_BOOL: case IS_LONG: - if (Z_TYPE_P(offset) == IS_DOUBLE) { - index = (long)Z_DVAL_P(offset); - } else { - index = Z_LVAL_P(offset); - } + index = Z_LVAL_P(offset); +num_index: if ((retval = zend_hash_index_find(ht, index)) == NULL) { switch (type) { case BP_VAR_R: