Skip to content

Commit 2436e15

Browse files
committed
Merge pull request #75
2 parents c4d0342 + e61b678 commit 2436e15

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

php_phongo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ bool phongo_execute_write(mongoc_client_t *client, const char *namespace, mongoc
597597
php_phongo_writeresult_t *writeresult;
598598

599599
if (!phongo_split_namespace(namespace, &dbname, &collname)) {
600-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s", "Invalid namespace provided");
600+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s: %s", "Invalid namespace provided", namespace);
601601
return false;
602602
}
603603

@@ -664,7 +664,7 @@ int phongo_execute_query(mongoc_client_t *client, const char *namespace, const p
664664
mongoc_collection_t *collection;
665665

666666
if (!phongo_split_namespace(namespace, &dbname, &collname)) {
667-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s", "Invalid namespace provided");
667+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s: %s", "Invalid namespace provided", namespace);
668668
return false;
669669
}
670670
collection = mongoc_client_get_collection(client, dbname, collname);

tests/standalone/bug0357.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
PHPC-357: The exception for "invalid namespace" does not list the broken name
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
5+
--FILE--
6+
<?php
7+
require_once __DIR__ . "/../utils/basic.inc";
8+
9+
$m = new MongoDB\Driver\Manager(STANDALONE);
10+
$c = new MongoDB\Driver\Query(array());
11+
12+
echo throws(function() use($m, $c) {
13+
$m->executeQuery( 'demo', $c );
14+
}, "MongoDB\\Driver\\Exception\\InvalidArgumentException"), "\n";
15+
16+
?>
17+
===DONE===
18+
<?php exit(0); ?>
19+
--EXPECT--
20+
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
21+
Invalid namespace provided: demo
22+
===DONE===

0 commit comments

Comments
 (0)