summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-09-08 20:38:08 +0000
committerAndi Gutmans <andi@php.net>1999-09-08 20:38:08 +0000
commit67daaa7aacfb3e5052177d645a5993e8e34388de (patch)
tree28f0eb79343bbc7bff0ca1332d710859bd27f63d /Zend/zend_execute.c
parent42e39d474bd0e6fa48511da1e02e386f31fc02bf (diff)
downloadphp-git-67daaa7aacfb3e5052177d645a5993e8e34388de.tar.gz
- Fix for floating point array offsets. Same behaviour as in PHP 3.0. We
casted to (long).
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index d4696ccd94..bbfbe66455 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -530,33 +530,37 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op
}
}
break;
+ case IS_DOUBLE:
case IS_LONG: {
- if (zend_hash_index_find(ht, dim->value.lval, (void **) &retval) == FAILURE) {
+ long index;
+
+ if(dim->type == IS_LONG) {
+ index = dim->value.lval;
+ } else {
+ index = (long)dim->value.dval;
+ }
+ if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined offset: %d", dim->value.lval);
+ zend_error(E_NOTICE,"Undefined offset: %d", index);
/* break missing intentionally */
case BP_VAR_IS:
retval = &EG(uninitialized_zval_ptr);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined offset: %d", dim->value.lval);
+ zend_error(E_NOTICE,"Undefined offset: %d", index);
/* break missing intentionally */
case BP_VAR_W: {
zval *new_zval = &EG(uninitialized_zval);
new_zval->refcount++;
- zend_hash_index_update(ht, dim->value.lval, &new_zval, sizeof(zval *), (void **) &retval);
+ zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval);
}
break;
}
}
}
break;
- /* we need to do implement this nicely somehow ZA
- case IS_DOUBLE:
- break;
- */
default:
zend_error(E_WARNING, "Illegal offset type");
if (type == BP_VAR_R || type == BP_VAR_IS) {