com php-src: Fixed resource to integer conversion: ext/spl/spl _array.c
| From: | Dmitry Stogov | Date: | Wed, 09 Apr 2014 18:31:40 +0000 |
| Subject: | com php-src: Fixed resource to integer conversion: ext/spl/spl _array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77453@lists.php.net to get a copy of this message | ||
Commit: a938b2460723f609a6524e8e91058985fdc2a897
Author: Dmitry Stogov <dmitry@zend.com> Wed, 9 Apr 2014 22:31:40 +0400
Parents: 816f8dfefb672950376741937ba9a9440b8ccc1f
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a938b2460723f609a6524e8e91058985fdc2a897
Log:
Fixed resource to integer conversion
Changed paths:
M ext/spl/spl_array.c
Diff:
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index ae817a0..3bd4b3d 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: