mattwil         Thu Jun  4 18:20:48 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src    README.PARAMETER_PARSING_API 
    /ZendEngine2        Zend.m4 zend_API.c zend_compile.c zend_execute.c 
                        zend_execute_API.c zend_operators.c zend_operators.h 
                        zend_vm_def.h zend_vm_execute.h 
    /php-src/win32/build        config.w32 
  Log:
  MFH:
  Restored double->long conversion behavior to that of PHP 5.2 (on most 
platforms) and prior:
   * Out-of-range numbers overflow/preserve least significant bits (no 
LONG_MAX/MIN limit)
   * See bug #42868 (presumably-rare platform with different results in 5.2)
   * On 32-bit platforms with 64-bit long type, a zend_long64 cast has been 
added,
      otherwise it's the same as 5.2
   * Use this conversion method everywhere instead of some plain (long) casts
  
  Added 'L' parameter parsing specifier to ensure a LONG_MAX/MIN limit:
   * Essentially what 5.3's new conversion was doing in most cases
   * Functions with "limit" or "length" type params could be updated to use 
this,
      and prevent confusing overflow behavior with huge numbers (*also* in 5.2)
    - See bug #47854, for example; or even #42868 again
  
  # Test updates coming
  
http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.7.6.2.2.6&r2=1.7.6.2.2.7&diff_format=u
Index: php-src/README.PARAMETER_PARSING_API
diff -u php-src/README.PARAMETER_PARSING_API:1.7.6.2.2.6 
php-src/README.PARAMETER_PARSING_API:1.7.6.2.2.7
--- php-src/README.PARAMETER_PARSING_API:1.7.6.2.2.6    Mon Nov 24 18:10:36 2008
+++ php-src/README.PARAMETER_PARSING_API        Thu Jun  4 18:20:42 2009
@@ -48,6 +48,7 @@
  h  - array (returned as HashTable*)
  H  - array or HASH_OF(object) (returned as HashTable*)
  l  - long (long)
+ L  - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long)
  o  - object of any type (zval*)
  O  - object of specific type given by class entry (zval*, zend_class_entry)
  r  - resource (zval*)
http://cvs.php.net/viewvc.cgi/ZendEngine2/Zend.m4?r1=1.58.4.4.2.5&r2=1.58.4.4.2.6&diff_format=u
Index: ZendEngine2/Zend.m4
diff -u ZendEngine2/Zend.m4:1.58.4.4.2.5 ZendEngine2/Zend.m4:1.58.4.4.2.6
--- ZendEngine2/Zend.m4:1.58.4.4.2.5    Tue Dec  2 16:19:09 2008
+++ ZendEngine2/Zend.m4 Thu Jun  4 18:20:42 2009
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: Zend.m4,v 1.58.4.4.2.5 2008/12/02 16:19:09 cseiler Exp $
+dnl $Id: Zend.m4,v 1.58.4.4.2.6 2009/06/04 18:20:42 mattwil Exp $
 dnl
 dnl This file contains Zend specific autoconf functions.
 dnl
@@ -117,6 +117,38 @@
 ZEND_FP_EXCEPT
 
 ZEND_CHECK_FLOAT_PRECISION
+
+dnl test whether double cast to long preserves least significant bits
+AC_MSG_CHECKING(whether double cast to long preserves least significant bits)
+
+AC_TRY_RUN([
+#include <limits.h>
+
+int main()
+{
+       if (sizeof(long) == 4) {
+               double d = (double) LONG_MIN * LONG_MIN + 2e9;
+
+               if ((long) d == 2e9 && (long) -d == -2e9) {
+                       exit(0);
+               }
+       } else if (sizeof(long) == 8) {
+               double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract 
ULONG_MAX + 1 */
+
+               if ((long) 18e18 == correct) { /* On 64-bit, only check between 
LONG_MAX and ULONG_MAX */
+                       exit(0);
+               }
+       }
+       exit(1);
+}
+], [
+  AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long 
preserves least significant bits])
+  AC_MSG_RESULT(yes)
+], [
+  AC_MSG_RESULT(no)
+], [
+  AC_MSG_RESULT(no)
+])
        
 ])
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.63&r2=1.296.2.27.2.34.2.64&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.63 
ZendEngine2/zend_API.c:1.296.2.27.2.34.2.64
--- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.63 Mon Apr  6 11:10:31 2009
+++ ZendEngine2/zend_API.c      Thu Jun  4 18:20:42 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_API.c,v 1.296.2.27.2.34.2.63 2009/04/06 11:10:31 dmitry Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.34.2.64 2009/06/04 18:20:42 mattwil Exp $ */
 
 #include "zend.h"
 #include "zend_execute.h"
@@ -313,6 +313,7 @@
 
        switch (c) {
                case 'l':
+               case 'L':
                        {
                                long *p = va_arg(*va, long *);
                                switch (Z_TYPE_PP(arg)) {
@@ -324,14 +325,33 @@
                                                        if ((type = 
is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) {
                                                                return "long";
                                                        } else if (type == 
IS_DOUBLE) {
-                                                               *p = (long) d;
+                                                               if (c == 'L') {
+                                                                       if (d > 
LONG_MAX) {
+                                                                               
*p = LONG_MAX;
+                                                                               
break;
+                                                                       } else 
if (d < LONG_MIN) {
+                                                                               
*p = LONG_MIN;
+                                                                               
break;
+                                                                       }
+                                                               }
+
+                                                               *p = 
zend_dval_to_lval(d);
                                                        }
                                                }
                                                break;
 
+                                       case IS_DOUBLE:
+                                               if (c == 'L') {
+                                                       if (Z_DVAL_PP(arg) > 
LONG_MAX) {
+                                                               *p = LONG_MAX;
+                                                               break;
+                                                       } else if 
(Z_DVAL_PP(arg) < LONG_MIN) {
+                                                               *p = LONG_MIN;
+                                                               break;
+                                                       }
+                                               }
                                        case IS_NULL:
                                        case IS_LONG:
-                                       case IS_DOUBLE:
                                        case IS_BOOL:
                                                convert_to_long_ex(arg);
                                                *p = Z_LVAL_PP(arg);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.107&r2=1.647.2.27.2.41.2.108&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.107 
ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.108
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.107    Wed Apr 22 21:27:19 2009
+++ ZendEngine2/zend_compile.c  Thu Jun  4 18:20:42 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.107 2009/04/22 21:27:19 shire Exp $ 
*/
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.108 2009/06/04 18:20:42 mattwil Exp 
$ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -3997,7 +3997,6 @@
        ALLOC_ZVAL(element);
        *element = expr->u.constant;
        if (offset) {
-               long l;
                switch (offset->u.constant.type & IS_CONSTANT_TYPE_MASK) {
                        case IS_CONSTANT:
                                /* Ugly hack to denote that this value has a 
constant index */
@@ -4020,8 +4019,7 @@
                                
zend_hash_index_update(Z_ARRVAL(result->u.constant), 
Z_LVAL(offset->u.constant), &element, sizeof(zval *), NULL);
                                break;
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL(offset->u.constant), l);
-                               
zend_hash_index_update(Z_ARRVAL(result->u.constant), l, &element, sizeof(zval 
*), NULL);
+                               
zend_hash_index_update(Z_ARRVAL(result->u.constant), 
zend_dval_to_lval(Z_DVAL(offset->u.constant)), &element, sizeof(zval *), NULL);
                                break;
                        case IS_CONSTANT_ARRAY:
                                zend_error(E_ERROR, "Illegal offset type");
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.716.2.12.2.24.2.43&r2=1.716.2.12.2.24.2.44&diff_format=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.43 
ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.44
--- ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.43     Tue Apr 21 09:40:13 2009
+++ ZendEngine2/zend_execute.c  Thu Jun  4 18:20:42 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.43 2009/04/21 09:40:13 dmitry Exp $ 
*/
+/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.44 2009/06/04 18:20:42 mattwil Exp 
$ */
 
 #define ZEND_INTENSIVE_DEBUGGING 0
 
@@ -823,10 +823,9 @@
                                }
                        }
                        break;
-               case IS_DOUBLE: {
-                       DVAL_TO_LVAL(Z_DVAL_P(dim), index);
+               case IS_DOUBLE:
+                       index = zend_dval_to_lval(Z_DVAL_P(dim));
                        goto num_index;
-               }
                case IS_RESOURCE:
                        zend_error(E_STRICT, "Resource ID#%ld used as offset, 
casting to integer (%ld)", Z_LVAL_P(dim), Z_LVAL_P(dim));
                        /* Fall Through */
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.76&r2=1.331.2.20.2.24.2.77&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.76 
ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.77
--- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.76 Wed Apr  8 13:17:58 2009
+++ ZendEngine2/zend_execute_API.c      Thu Jun  4 18:20:42 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.76 2009/04/08 13:17:58 dmitry 
Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.77 2009/06/04 18:20:42 mattwil 
Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -662,7 +662,7 @@
                                        ret = 
zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, 
Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
                                        break;
                                case IS_DOUBLE:
-                                       ret = 
zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, 
(long)Z_DVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+                                       ret = 
zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, 
zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE, NULL);
                                        break;
                                case IS_NULL:
                                        ret = 
zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0, 
HASH_UPDATE_KEY_IF_BEFORE, NULL);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.208.2.4.2.23.2.26&r2=1.208.2.4.2.23.2.27&diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.26 
ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.27
--- ZendEngine2/zend_operators.c:1.208.2.4.2.23.2.26    Mon May 11 08:31:15 2009
+++ ZendEngine2/zend_operators.c        Thu Jun  4 18:20:42 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.26 2009/05/11 08:31:15 jani Exp $ 
*/
+/* $Id: zend_operators.c,v 1.208.2.4.2.23.2.27 2009/06/04 18:20:42 mattwil Exp 
$ */
 
 #include <ctype.h>
 
@@ -225,7 +225,7 @@
                                Z_LVAL(holder) = 0;                             
                                        \
                                break;                                          
                                                \
                        case IS_DOUBLE:                                         
                                        \
-                               DVAL_TO_LVAL(Z_DVAL_P(op), Z_LVAL(holder));     
                \
+                               Z_LVAL(holder) = 
zend_dval_to_lval(Z_DVAL_P(op));       \
                                break;                                          
                                                \
                        case IS_STRING:                                         
                                        \
                                Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 
10);      \
@@ -349,7 +349,7 @@
                case IS_LONG:
                        break;
                case IS_DOUBLE:
-                       DVAL_TO_LVAL(Z_DVAL_P(op), Z_LVAL_P(op));
+                       Z_LVAL_P(op) = zend_dval_to_lval(Z_DVAL_P(op));
                        break;
                case IS_STRING:
                        {
@@ -1017,7 +1017,7 @@
                ZVAL_LONG(result, ~Z_LVAL_P(op1));
                return SUCCESS;
        } else if (Z_TYPE_P(op1) == IS_DOUBLE) {
-               ZVAL_LONG(result, ~(long) Z_DVAL_P(op1));
+               ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1)));
                return SUCCESS;
        } else if (Z_TYPE_P(op1) == IS_STRING) {
                int i;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.h?r1=1.94.2.4.2.10.2.15&r2=1.94.2.4.2.10.2.16&diff_format=u
Index: ZendEngine2/zend_operators.h
diff -u ZendEngine2/zend_operators.h:1.94.2.4.2.10.2.15 
ZendEngine2/zend_operators.h:1.94.2.4.2.10.2.16
--- ZendEngine2/zend_operators.h:1.94.2.4.2.10.2.15     Sun May 10 22:39:33 2009
+++ ZendEngine2/zend_operators.h        Thu Jun  4 18:20:42 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.h,v 1.94.2.4.2.10.2.15 2009/05/10 22:39:33 jani Exp $ */
+/* $Id: zend_operators.h,v 1.94.2.4.2.10.2.16 2009/06/04 18:20:42 mattwil Exp 
$ */
 
 #ifndef ZEND_OPERATORS_H
 #define ZEND_OPERATORS_H
@@ -63,39 +63,24 @@
 ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, 
const zend_class_entry *ce TSRMLS_DC);
 END_EXTERN_C()
 
-/* {{{ DVAL_TO_LVAL */
-#define MAX_UNSIGNED_INT ((double) LONG_MAX * 2) + 1
-#ifdef _WIN64
-# define DVAL_TO_LVAL(d, l) \
-       if ((d) > LONG_MAX) { \
-               (l) = (long)(unsigned long)(__int64) (d); \
-       } else { \
-               (l) = (long) (d); \
-       }
-#elif !defined(_WIN64) && __WORDSIZE == 64
-# define DVAL_TO_LVAL(d, l) \
-       if ((d) >= LONG_MAX) { \
-               (l) = LONG_MAX; \
-       } else if ((d) <= LONG_MIN) { \
-               (l) = LONG_MIN; \
-       } else { \
-               (l) = (long) (d); \
+#if ZEND_DVAL_TO_LVAL_CAST_OK
+# define zend_dval_to_lval(d) ((long) (d))
+#elif SIZEOF_LONG == 4 && defined(HAVE_ZEND_LONG64)
+static zend_always_inline long zend_dval_to_lval(double d)
+{
+       if (d > LONG_MAX || d < LONG_MIN) {
+               return (long)(unsigned long)(zend_long64) d;
        }
+       return (long) d;
+}
 #else
-# define DVAL_TO_LVAL(d, l) \
-       if ((d) > LONG_MAX) { \
-               if ((d) > MAX_UNSIGNED_INT) { \
-                       (l) = LONG_MAX; \
-               } else { \
-                       (l) = (unsigned long) (d); \
-               } \
-       } else { \
-               if((d) < LONG_MIN) { \
-                       (l) = LONG_MIN; \
-               } else { \
-                       (l) = (long) (d); \
-               } \
+static zend_always_inline long zend_dval_to_lval(double d)
+{
+       if (d > LONG_MAX) {
+               return (long)(unsigned long) d;
        }
+       return (long) d;
+}
 #endif
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.92&r2=1.59.2.29.2.48.2.93&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.92 
ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.93
--- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.92       Mon Jun  1 15:07:42 2009
+++ ZendEngine2/zend_vm_def.h   Thu Jun  4 18:20:42 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.92 2009/06/01 15:07:42 lbarnaud Exp $ 
*/
+/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.93 2009/06/04 18:20:42 mattwil Exp $ 
*/
 
 /* If you change this file, please regenerate the zend_vm_execute.h and
  * zend_vm_opcodes.h files by running:
@@ -3085,11 +3085,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -3408,7 +3406,6 @@
        zend_free_op free_op1, free_op2;
        zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_UNSET);
        zval *offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
-       long index;
 
        if (OP1_TYPE != IS_VAR || container) {
                if (OP1_TYPE == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -3420,14 +3417,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (OP2_TYPE == IS_CV || 
OP2_TYPE == IS_VAR) {
@@ -3907,7 +3902,6 @@
        zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_IS);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (OP1_TYPE != IS_VAR || container) {
                zend_free_op free_op2;
@@ -3921,16 +3915,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.49.2.92&r2=1.62.2.30.2.49.2.93&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.92 
ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.93
--- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.92   Mon Jun  1 15:07:42 2009
+++ ZendEngine2/zend_vm_execute.h       Thu Jun  4 18:20:42 2009
@@ -2850,11 +2850,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -3367,11 +3365,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -3835,11 +3831,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -4027,11 +4021,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -4494,11 +4486,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -6086,11 +6076,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -6554,11 +6542,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -7022,11 +7008,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -7117,11 +7101,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -7582,11 +7564,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -10616,11 +10596,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -10670,7 +10648,6 @@
        zend_free_op free_op1;
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval *offset = &opline->op2.u.constant;
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
                if (IS_VAR == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -10682,14 +10659,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_CONST == IS_CV || 
IS_CONST == IS_VAR) {
@@ -10801,7 +10776,6 @@
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
 
@@ -10815,16 +10789,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -12373,11 +12345,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -12427,7 +12397,6 @@
        zend_free_op free_op1, free_op2;
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 
TSRMLS_CC);
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
                if (IS_VAR == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -12439,14 +12408,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_TMP_VAR == IS_CV || 
IS_TMP_VAR == IS_VAR) {
@@ -12558,7 +12525,6 @@
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
                zend_free_op free_op2;
@@ -12572,16 +12538,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -14181,11 +14145,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -14235,7 +14197,6 @@
        zend_free_op free_op1, free_op2;
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 
TSRMLS_CC);
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
                if (IS_VAR == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -14247,14 +14208,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_VAR == IS_CV || IS_VAR 
== IS_VAR) {
@@ -14366,7 +14325,6 @@
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
                zend_free_op free_op2;
@@ -14380,16 +14338,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -15051,11 +15007,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -16577,11 +16531,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -16631,7 +16583,6 @@
        zend_free_op free_op1;
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R 
TSRMLS_CC);
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
                if (IS_VAR == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -16643,14 +16594,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_CV == IS_CV || IS_CV == 
IS_VAR) {
@@ -16762,7 +16711,6 @@
        zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), 
&free_op1 TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_VAR != IS_VAR || container) {
 
@@ -16776,16 +16724,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -17829,7 +17775,6 @@
 
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval *offset = &opline->op2.u.constant;
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
                if (IS_UNUSED == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -17841,14 +17786,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_CONST == IS_CV || 
IS_CONST == IS_VAR) {
@@ -17958,7 +17901,6 @@
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
 
@@ -17972,16 +17914,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -18892,7 +18832,6 @@
        zend_free_op free_op2;
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 
TSRMLS_CC);
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
                if (IS_UNUSED == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -18904,14 +18843,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_TMP_VAR == IS_CV || 
IS_TMP_VAR == IS_VAR) {
@@ -19021,7 +18958,6 @@
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
                zend_free_op free_op2;
@@ -19035,16 +18971,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -19955,7 +19889,6 @@
        zend_free_op free_op2;
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 
TSRMLS_CC);
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
                if (IS_UNUSED == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -19967,14 +19900,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_VAR == IS_CV || IS_VAR 
== IS_VAR) {
@@ -20084,7 +20015,6 @@
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
                zend_free_op free_op2;
@@ -20098,16 +20028,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -21277,7 +21205,6 @@
 
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R 
TSRMLS_CC);
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
                if (IS_UNUSED == IS_CV && container != 
&EG(uninitialized_zval_ptr)) {
@@ -21289,14 +21216,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_CV == IS_CV || IS_CV == 
IS_VAR) {
@@ -21406,7 +21331,6 @@
        zval **container = _get_obj_zval_ptr_ptr_unused(TSRMLS_C);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_UNUSED != IS_VAR || container) {
 
@@ -21420,16 +21344,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -24205,11 +24127,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -24259,7 +24179,6 @@
 
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), 
BP_VAR_UNSET TSRMLS_CC);
        zval *offset = &opline->op2.u.constant;
-       long index;
 
        if (IS_CV != IS_VAR || container) {
                if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) 
{
@@ -24271,14 +24190,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_CONST == IS_CV || 
IS_CONST == IS_VAR) {
@@ -24388,7 +24305,6 @@
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS 
TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_CV != IS_VAR || container) {
 
@@ -24402,16 +24318,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -25853,11 +25767,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -25907,7 +25819,6 @@
        zend_free_op free_op2;
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), 
BP_VAR_UNSET TSRMLS_CC);
        zval *offset = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 
TSRMLS_CC);
-       long index;
 
        if (IS_CV != IS_VAR || container) {
                if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) 
{
@@ -25919,14 +25830,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_TMP_VAR == IS_CV || 
IS_TMP_VAR == IS_VAR) {
@@ -26036,7 +25945,6 @@
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS 
TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_CV != IS_VAR || container) {
                zend_free_op free_op2;
@@ -26050,16 +25958,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -27551,11 +27457,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -27605,7 +27509,6 @@
        zend_free_op free_op2;
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), 
BP_VAR_UNSET TSRMLS_CC);
        zval *offset = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 
TSRMLS_CC);
-       long index;
 
        if (IS_CV != IS_VAR || container) {
                if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) 
{
@@ -27617,14 +27520,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_VAR == IS_CV || IS_VAR 
== IS_VAR) {
@@ -27734,7 +27635,6 @@
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS 
TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_CV != IS_VAR || container) {
                zend_free_op free_op2;
@@ -27748,16 +27648,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
@@ -28318,11 +28216,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -29738,11 +29634,9 @@
                }
        }
        if (offset) {
-               long l;
                switch (Z_TYPE_P(offset)) {
                        case IS_DOUBLE:
-                               DVAL_TO_LVAL(Z_DVAL_P(offset), l);
-                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
l, &expr_ptr, sizeof(zval *), NULL);
+                               zend_hash_index_update(Z_ARRVAL_P(array_ptr), 
zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL);
                                break;
                        case IS_LONG:
                        case IS_BOOL:
@@ -29792,7 +29686,6 @@
 
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), 
BP_VAR_UNSET TSRMLS_CC);
        zval *offset = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R 
TSRMLS_CC);
-       long index;
 
        if (IS_CV != IS_VAR || container) {
                if (IS_CV == IS_CV && container != &EG(uninitialized_zval_ptr)) 
{
@@ -29804,14 +29697,12 @@
 
                                switch (Z_TYPE_P(offset)) {
                                        case IS_DOUBLE:
-                                               index = (long) Z_DVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)));
                                                break;
                                        case IS_RESOURCE:
                                        case IS_BOOL:
                                        case IS_LONG:
-                                               index = Z_LVAL_P(offset);
-                                               zend_hash_index_del(ht, index);
+                                               zend_hash_index_del(ht, 
Z_LVAL_P(offset));
                                                break;
                                        case IS_STRING:
                                                if (IS_CV == IS_CV || IS_CV == 
IS_VAR) {
@@ -29921,7 +29812,6 @@
        zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_IS 
TSRMLS_CC);
        zval **value = NULL;
        int result = 0;
-       long index;
 
        if (IS_CV != IS_VAR || container) {
 
@@ -29935,16 +29825,14 @@
 
                        switch (Z_TYPE_P(offset)) {
                                case IS_DOUBLE:
-                                       index = (long) Z_DVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
zend_dval_to_lval(Z_DVAL_P(offset)), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
                                case IS_RESOURCE:
                                case IS_BOOL:
                                case IS_LONG:
-                                       index = Z_LVAL_P(offset);
-                                       if (zend_hash_index_find(ht, index, 
(void **) &value) == SUCCESS) {
+                                       if (zend_hash_index_find(ht, 
Z_LVAL_P(offset), (void **) &value) == SUCCESS) {
                                                isset = 1;
                                        }
                                        break;
http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.40.2.8.2.10.2.48&r2=1.40.2.8.2.10.2.49&diff_format=u
Index: php-src/win32/build/config.w32
diff -u php-src/win32/build/config.w32:1.40.2.8.2.10.2.48 
php-src/win32/build/config.w32:1.40.2.8.2.10.2.49
--- php-src/win32/build/config.w32:1.40.2.8.2.10.2.48   Fri Apr 24 15:18:37 2009
+++ php-src/win32/build/config.w32      Thu Jun  4 18:20:45 2009
@@ -1,5 +1,5 @@
 // vim:ft=javascript
-// $Id: config.w32,v 1.40.2.8.2.10.2.48 2009/04/24 15:18:37 pajoye Exp $
+// $Id: config.w32,v 1.40.2.8.2.10.2.49 2009/06/04 18:20:45 mattwil Exp $
 // "Master" config file; think of it as a configure.in
 // equivalent.
 
@@ -324,6 +324,10 @@
        zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c 
zend_closures.c \
        zend_float.c");
 
+if (VCVERS == 1200) {
+       AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
+}
+
 ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c getopt.c 
fopen_wrappers.c \
        php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
        strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c 
network.c \

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to