From 6d19a243fd4993893d7ae61fbdd2be94d817d4de Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 18 Sep 2015 16:28:46 -0400 Subject: [PATCH] PHPC-410: Make BSON exception message consistent with HHVM --- src/bson.c | 2 +- tests/bson/bson-fromPHP_error-003.phpt | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/bson.c b/src/bson.c index 76824f7a1..12b3651f3 100644 --- a/src/bson.c +++ b/src/bson.c @@ -807,7 +807,7 @@ PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t * break; } else if (instanceof_function(Z_OBJCE_P(data), php_phongo_type_ce TSRMLS_CC)) { - phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s cannot be serialized as a root element", Z_OBJCE_P(data)->name); + phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s instance %s cannot be serialized as a root element", php_phongo_type_ce->name, Z_OBJCE_P(data)->name); break; } diff --git a/tests/bson/bson-fromPHP_error-003.phpt b/tests/bson/bson-fromPHP_error-003.phpt index dd0a644cb..e5df93a14 100644 --- a/tests/bson/bson-fromPHP_error-003.phpt +++ b/tests/bson/bson-fromPHP_error-003.phpt @@ -34,21 +34,21 @@ foreach ($tests as $document) { --EXPECTF-- OK: Got MongoDB\Driver\Exception\UnexpectedValueException -UnknownType cannot be serialized as a root element +%S\BSON\Type instance UnknownType cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\Binary cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\Binary cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\Javascript cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\Javascript cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\MinKey cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\MinKey cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\MaxKey cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\MaxKey cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\ObjectID cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\ObjectID cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\Regex cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\Regex cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\Timestamp cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\Timestamp cannot be serialized as a root element OK: Got MongoDB\Driver\Exception\UnexpectedValueException -%S\BSON\UTCDateTime cannot be serialized as a root element +%S\BSON\Type instance %S\BSON\UTCDateTime cannot be serialized as a root element ===DONE===