]> granicus.if.org Git - php/commitdiff
- For Ilia:
authorAndi Gutmans <andi@php.net>
Fri, 29 Oct 2004 00:55:11 +0000 (00:55 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 29 Oct 2004 00:55:11 +0000 (00:55 +0000)
- MFH: Fixed bug #30572 (crash when comparing SimpleXML attribute to a boolean).
- Hope this works well. I will MFH tomorrow if no one complains.

Zend/zend_operators.c

index 4fea659469536c9e4cc4dad1166d0ffe31ec1a8d..0e3caeaeaa26163974c29fbd4ce665c77b8411b3 100644 (file)
@@ -140,7 +140,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
 }
 
 #define zendi_convert_scalar_to_number(op, holder, result)                     \
-       if (op==result) {                                                                                               \
+       if (op==result || op->refcount == 0) {                                                                                          \
                if (op->type != IS_LONG) {                                                                      \
                        convert_scalar_to_number(op TSRMLS_CC);                                 \
                }                                                                                                                       \
@@ -194,7 +194,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
 } while (0)
 
 #define zendi_convert_to_long(op, holder, result)                                      \
-       if (op==result) {                                                                                               \
+       if (op == result || op->refcount == 0) {                                                                                                \
                convert_to_long(op);                                                                            \
        } else if ((op)->type != IS_LONG) {                                                             \
                switch ((op)->type) {                                                                           \
@@ -230,7 +230,7 @@ ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC)
 
 
 #define zendi_convert_to_boolean(op, holder, result)                           \
-       if (op==result) {                                                                                               \
+       if (op==result || op->refcount == 0) {                                                                                          \
                convert_to_boolean(op);                                                                         \
        } else if ((op)->type != IS_BOOL) {                                                             \
                switch ((op)->type) {                                                                           \