File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,9 @@ PHP_METHOD(Cursor, current)
311311
312312 data = php_phongo_cursor_get_current_data (intern );
313313
314- if (data ) {
314+ if (Z_ISUNDEF_P (data )) {
315+ RETURN_NULL ();
316+ } else {
315317 ZVAL_COPY_DEREF (return_value , data );
316318 }
317319}
Original file line number Diff line number Diff line change 1+ --TEST--
2+ PHPC-1713: MongoDB\Driver\Cursor::current() does not return anything
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php skip_if_not_live (); ?>
6+ --FILE--
7+ <?php
8+ require_once __DIR__ . "/../utils/basic.inc " ;
9+
10+ $ manager = new MongoDB \Driver \Manager (URI );
11+
12+ $ cursor = $ manager ->executeQuery (NS , new MongoDB \Driver \Query ([]));
13+
14+ var_dump ($ cursor ->valid ());
15+ var_dump ($ cursor ->current ());
16+
17+ ?>
18+ ===DONE===
19+ <?php exit (0 ); ?>
20+ --EXPECTF--
21+ bool(false)
22+ NULL
23+ ===DONE===
You can’t perform that action at this time.
0 commit comments