Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bson.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
18 changes: 9 additions & 9 deletions tests/bson/bson-fromPHP_error-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ foreach ($tests as $document) {
<?php exit(0); ?>
--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===