]> granicus.if.org Git - php/commitdiff
Drop duplicate object-to-type notices
authorNikita Popov <nikic@php.net>
Mon, 22 Jun 2015 14:24:11 +0000 (16:24 +0200)
committerNikita Popov <nikic@php.net>
Mon, 22 Jun 2015 14:25:32 +0000 (16:25 +0200)
We already generate a recoverable fatal for these earlier, no need
to throw an additional notice.

Zend/tests/call_with_refs.phpt
Zend/zend_operators.c
ext/openssl/tests/003.phpt
ext/standard/tests/general_functions/type.phpt
tests/classes/tostring_004.phpt

index acad134f874325a41d688ce062766a2033f576f5..84c4edfc2095082f9c3f13391221f92c4a38c91b 100644 (file)
@@ -14,5 +14,4 @@ $data = call_user_func_array("substr_replace",array(&$my_var, new StdClass(),1))
 echo "OK!";
 --EXPECT--     
 Object of class stdClass could not be converted to string
-Object of class stdClass to string conversion
 OK!
index 26584745dcc4bd81800e910d62643cd2d1da66c2..d9670a5a499b1931072601e8d954af5cd5d8192a 100644 (file)
@@ -226,7 +226,7 @@ try_again:
 
 /* }}} */
 
-/* {{{ convert_object_to_type */
+/* {{{ convert_object_to_type: dst will be either ctype or UNDEF */
 #define convert_object_to_type(op, dst, ctype, conv_func)                                                                      \
        ZVAL_UNDEF(dst);                                                                                                                                                \
        if (Z_OBJ_HT_P(op)->cast_object) {                                                                                                              \
@@ -332,7 +332,6 @@ try_again:
                                if (Z_TYPE(dst) == IS_LONG) {
                                        ZVAL_COPY_VALUE(op, &dst);
                                } else {
-                                       zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val);
 
                                        ZVAL_LONG(op, 1);
                                }
@@ -393,8 +392,6 @@ try_again:
                                if (Z_TYPE(dst) == IS_DOUBLE) {
                                        ZVAL_COPY_VALUE(op, &dst);
                                } else {
-                                       zend_error(E_NOTICE, "Object of class %s could not be converted to float", Z_OBJCE_P(op)->name->val);
-
                                        ZVAL_DOUBLE(op, 1.0);
                                }
                                break;
@@ -542,13 +539,11 @@ try_again:
                        zval dst;
 
                        convert_object_to_type(op, &dst, IS_STRING, convert_to_string);
+                       zval_dtor(op);
 
                        if (Z_TYPE(dst) == IS_STRING) {
-                               zval_dtor(op);
                                ZVAL_COPY_VALUE(op, &dst);
                        } else {
-                               zend_error(E_NOTICE, "Object of class %s to string conversion", Z_OBJCE_P(op)->name->val);
-                               zval_dtor(op);
                                ZVAL_NEW_STR(op, zend_string_init("Object", sizeof("Object")-1, 0));
                        }
                        break;
@@ -742,7 +737,6 @@ try_again:
                                if (Z_TYPE(dst) == IS_LONG) {
                                        return Z_LVAL(dst);
                                } else {
-                                       zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val);
                                        return 1;
                                }
                        }
@@ -782,8 +776,6 @@ try_again:
                                if (Z_TYPE(dst) == IS_DOUBLE) {
                                        return Z_DVAL(dst);
                                } else {
-                                       zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name->val);
-
                                        return 1.0;
                                }
                        }
index 92c8c85b1381fd86bf42862946fee56af497d577..39363c4548caf756fff1911f225086d6207f05f1 100644 (file)
@@ -27,7 +27,6 @@ echo "Done\n";
 ?>
 --EXPECTF--    
 string(57) "Object of class stdClass could not be converted to string"
-string(45) "Object of class stdClass to string conversion"
 string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
 bool(false)
 object(stdClass)#1 (0) {
index 74ba9e61036cb11bab723e2e3dca967b86a38c2c..eb6f0672fea020e3bff80e6d8836522c9acecd76 100644 (file)
@@ -345,7 +345,6 @@ string(14) "Resource id #%d"
 bool(true)
 string(14) "Resource id #%d"
 string(57) "Object of class stdClass could not be converted to string"
-string(45) "Object of class stdClass to string conversion"
 bool(true)
 string(6) "Object"
 Done
index de0283e8e62a1ca3846522b5cf44548f3d67c304..48e86682359a813d3e63f2ac0a23b68a216ed680 100644 (file)
@@ -38,7 +38,6 @@ printf($obj . "\n");
 Object with no __toString():
 Try 1:
 Error: 4096 - Object of class stdClass could not be converted to string
-Error: 8 - Object of class stdClass to string conversion
 Object
 
 Try 2: