- Fix bug #2364.
authorAndi Gutmans <andi@php.net>
Thu, 23 Sep 1999 16:13:31 +0000 (16:13 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 23 Sep 1999 16:13:31 +0000 (16:13 +0000)
  I haven't checked all of the conversion macros yet but there's a change
  there are more such bugs there.

Zend/zend_operators.c

index 01e834f75bb2f6d0e88c0bd5e32f157970e573ba..ec1b755ed74992dc70d8fc401042132455664833 100644 (file)
@@ -83,7 +83,7 @@ ZEND_API void convert_scalar_to_number(zval *op)
                }                                                                                                                       \
                (op) = &(holder);                                                                                       \
        } else if ((op)->type==IS_BOOL || (op)->type==IS_RESOURCE) {    \
-               (holder) = *(op);                                                                                       \
+               (holder).value.lval = (op)->value.lval;                                         \
                (holder).type = IS_LONG;                                                                        \
                (op) = &(holder);                                                                                       \
        }
@@ -93,11 +93,12 @@ ZEND_API void convert_scalar_to_number(zval *op)
 #define zendi_convert_to_long(op, holder, result)                                      \
        if (op==result) {                                                                                               \
                convert_to_long(op);                                                                            \
+       } else if ((op)->type==IS_BOOL || (op)->type==IS_RESOURCE) {    \
+               (holder).value.lval = (op)->value.lval;                                         \
+               (holder).type = IS_LONG;                                                                        \
+               (op) = &(holder);                                                                                       \
        } else if ((op)->type != IS_LONG) {                                                             \
                switch ((op)->type) {                                                                           \
-                       case IS_RESOURCE:                                                                               \
-                       case IS_BOOL:                                                                                   \
-                               break;                                                                                          \
                        case IS_DOUBLE:                                                                                 \
                                (holder).value.lval = (long) (op)->value.dval;          \
                                break;                                                                                          \