Browse Source

Drop duplicate object-to-type notices

We already generate a recoverable fatal for these earlier, no need
to throw an additional notice.
pull/1356/head
Nikita Popov 11 years ago
parent
commit
8a83aed458
  1. 1
      Zend/tests/call_with_refs.phpt
  2. 12
      Zend/zend_operators.c
  3. 1
      ext/openssl/tests/003.phpt
  4. 1
      ext/standard/tests/general_functions/type.phpt
  5. 1
      tests/classes/tostring_004.phpt

1
Zend/tests/call_with_refs.phpt

@ -14,5 +14,4 @@ $data = call_user_func_array("substr_replace",array(&$my_var, new StdClass(),1))
echo "OK!"; echo "OK!";
--EXPECT-- --EXPECT--
Object of class stdClass could not be converted to string Object of class stdClass could not be converted to string
Object of class stdClass to string conversion
OK! OK!

12
Zend/zend_operators.c

@ -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) \ #define convert_object_to_type(op, dst, ctype, conv_func) \
ZVAL_UNDEF(dst); \ ZVAL_UNDEF(dst); \
if (Z_OBJ_HT_P(op)->cast_object) { \ if (Z_OBJ_HT_P(op)->cast_object) { \
@ -332,7 +332,6 @@ try_again:
if (Z_TYPE(dst) == IS_LONG) { if (Z_TYPE(dst) == IS_LONG) {
ZVAL_COPY_VALUE(op, &dst); ZVAL_COPY_VALUE(op, &dst);
} else { } 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); ZVAL_LONG(op, 1);
} }
@ -393,8 +392,6 @@ try_again:
if (Z_TYPE(dst) == IS_DOUBLE) { if (Z_TYPE(dst) == IS_DOUBLE) {
ZVAL_COPY_VALUE(op, &dst); ZVAL_COPY_VALUE(op, &dst);
} else { } 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); ZVAL_DOUBLE(op, 1.0);
} }
break; break;
@ -542,13 +539,11 @@ try_again:
zval dst; zval dst;
convert_object_to_type(op, &dst, IS_STRING, convert_to_string); convert_object_to_type(op, &dst, IS_STRING, convert_to_string);
zval_dtor(op);
if (Z_TYPE(dst) == IS_STRING) { if (Z_TYPE(dst) == IS_STRING) {
zval_dtor(op);
ZVAL_COPY_VALUE(op, &dst); ZVAL_COPY_VALUE(op, &dst);
} else { } 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)); ZVAL_NEW_STR(op, zend_string_init("Object", sizeof("Object")-1, 0));
} }
break; break;
@ -742,7 +737,6 @@ try_again:
if (Z_TYPE(dst) == IS_LONG) { if (Z_TYPE(dst) == IS_LONG) {
return Z_LVAL(dst); return Z_LVAL(dst);
} else { } else {
zend_error(E_NOTICE, "Object of class %s could not be converted to int", Z_OBJCE_P(op)->name->val);
return 1; return 1;
} }
} }
@ -782,8 +776,6 @@ try_again:
if (Z_TYPE(dst) == IS_DOUBLE) { if (Z_TYPE(dst) == IS_DOUBLE) {
return Z_DVAL(dst); return Z_DVAL(dst);
} else { } else {
zend_error(E_NOTICE, "Object of class %s could not be converted to double", Z_OBJCE_P(op)->name->val);
return 1.0; return 1.0;
} }
} }

1
ext/openssl/tests/003.phpt

@ -27,7 +27,6 @@ echo "Done\n";
?> ?>
--EXPECTF-- --EXPECTF--
string(57) "Object of class stdClass could not be converted to string" 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" string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
bool(false) bool(false)
object(stdClass)#1 (0) { object(stdClass)#1 (0) {

1
ext/standard/tests/general_functions/type.phpt

@ -345,7 +345,6 @@ string(14) "Resource id #%d"
bool(true) bool(true)
string(14) "Resource id #%d" string(14) "Resource id #%d"
string(57) "Object of class stdClass could not be converted to string" string(57) "Object of class stdClass could not be converted to string"
string(45) "Object of class stdClass to string conversion"
bool(true) bool(true)
string(6) "Object" string(6) "Object"
Done Done

1
tests/classes/tostring_004.phpt

@ -38,7 +38,6 @@ printf($obj . "\n");
Object with no __toString(): Object with no __toString():
Try 1: Try 1:
Error: 4096 - Object of class stdClass could not be converted to string Error: 4096 - Object of class stdClass could not be converted to string
Error: 8 - Object of class stdClass to string conversion
Object Object
Try 2: Try 2:

Loading…
Cancel
Save