Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-1390

MongoCursor::hasNext() may fail with one result or on getMore boundaries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.2
    • Component/s: pecl-mongo
    • Labels:
      None
    • # Replies:
      19
    • Last comment by Customer:
      true
    • Story Points:
      5
    • Sprint:
      PHP Sprint 15

      Description

      Via FREE-69840:h

      It looks like the cursor positioning behavior has changed in the 1.6.1 php
      driver

      the mongocursor returned by find used to position the cursor before the
      first record so hasNext would return true and getNext following would
      return the first record

      with 1.5.8 this was true and worked well

      with 1.6.1 php driver this has change, the cursor is positioned at the
      first record.

      This is with mongodb 1.6

      Reproducable script:

      <?php
      $m = new MongoClient;
       
      $c = $m->demo->test; 
      $c->drop();
      $c->insert( [ 'fpp' => 42 ] );
       
      $import = $c->find();
       
      var_dump($import->hasNext());
      var_dump($import->getNext());
      ?>

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since reply:
                  4 years, 31 weeks, 5 days ago
                  Date of 1st Reply: