Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added test case for PHP-369: Segfault with GridFS.

  • Loading branch information...
commit 2cc86236f5d1f07606a39b396e47dd7c8a999a79 1 parent 11ce8d5
@derickr authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 tests/bug00369.phpt
View
35 tests/bug00369.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test for PHP-369: Segfaults with iterating over GridFS with an _id set
+--FILE--
+<?php
+class CursorWrapper implements Iterator
+{
+ protected $mongoCursor;
+
+ public function __construct(MongoCursor $mongoCursor)
+ { $this->mongoCursor = $mongoCursor; }
+
+ public function current()
+ { return $this->mongoCursor->current(); }
+
+ public function key()
+ { return $this->mongoCursor->key(); }
+
+ public function rewind()
+ { return $this->mongoCursor->rewind(); }
+
+ public function next()
+ { return $this->mongoCursor->next(); }
+
+ public function valid()
+ { return $this->mongoCursor->valid(); }
+}
+$mongo = new Mongo('127.0.0.1');
+$mongo_db = $mongo->selectDB('phpunit');
+$cursor = $mongo_db->getGridFS()->find()->limit(20);
+$wrappedCursor = new CursorWrapper($cursor);
+iterator_to_array($wrappedCursor);
+echo "OK\n";
+?>
+--EXPECT--
+OK
Please sign in to comment.
Something went wrong with that request. Please try again.