]> granicus.if.org Git - php/commitdiff
- BC: php objects convert to int/double 1 with notice
authorMarcus Boerger <helly@php.net>
Thu, 6 Oct 2005 19:11:01 +0000 (19:11 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 6 Oct 2005 19:11:01 +0000 (19:11 +0000)
Zend/zend_object_handlers.c

index 976c24b51b428b00e2372934b54d08d9b019626f..3940d3f433022040c38c80854ee48a041538f085 100644 (file)
@@ -1042,6 +1042,18 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
                        INIT_PZVAL(writeobj);
                        ZVAL_BOOL(writeobj, 1);
                        return SUCCESS;
+               case IS_LONG:
+                       ce = Z_OBJCE_P(readobj);
+                       zend_error(E_NOTICE, "Object of class %v could not be converted to int", ce->name);
+                       INIT_PZVAL(writeobj);
+                       ZVAL_LONG(writeobj, 1);
+                       return SUCCESS;
+               case IS_DOUBLE:
+                       ce = Z_OBJCE_P(readobj);
+                       zend_error(E_NOTICE, "Object of class %v could not be converted to double", ce->name);
+                       INIT_PZVAL(writeobj);
+                       ZVAL_DOUBLE(writeobj, 1);
+                       return SUCCESS;
                default:
                        break;
        }