Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-215

Cannot traverse Cursor with IteratorIterator

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.4.0
    • Affects Version/s: 0.3.1
    • Component/s: None
    • None

      Traversing a IteratorIterator constructed from a Result yields no results. In PHPLIB, it's also possible to trigger a segfault due to an uninitialized result zval on the returned iterator:

      #0  0x000000000083a927 in zval_delref_p (pz=0x5a5a5a5a5a5a5a5a) at /tmp/build_php-5.6.5.Xhp/php-5.6.5/Zend/zend.h:411
      411	/tmp/build_php-5.6.5.Xhp/php-5.6.5/Zend/zend.h: No such file or directory.
      (gdb) bt full
      #0  0x000000000083a927 in zval_delref_p (pz=0x5a5a5a5a5a5a5a5a) at /tmp/build_php-5.6.5.Xhp/php-5.6.5/Zend/zend.h:411
      No locals.
      #1  0x000000000083aab3 in i_zval_ptr_dtor (zval_ptr=0x5a5a5a5a5a5a5a5a, __zend_filename=0x7f83eb5ffb90 "/home/jmikola/workspace/mongodb/phongo/php_phongo.c", __zend_lineno=1427)
          at /tmp/build_php-5.6.5.Xhp/php-5.6.5/Zend/zend_execute.h:76
              __PRETTY_FUNCTION__ = "i_zval_ptr_dtor"
      #2  0x000000000083bdef in _zval_ptr_dtor (zval_ptr=0x27c7c40, __zend_filename=0x7f83eb5ffb90 "/home/jmikola/workspace/mongodb/phongo/php_phongo.c", __zend_lineno=1427)
          at /tmp/build_php-5.6.5.Xhp/php-5.6.5/Zend/zend_execute_API.c:424
      No locals.
      #3  0x00007f83eb5ed513 in phongo_result_iterator_invalidate_current (iter=0x2b0a6c0) at /home/jmikola/workspace/mongodb/phongo/php_phongo.c:1427
              result = 0x27c7bf8
      #4  0x00000000006ce5af in spl_dual_it_free (intern=0x2b00ef0) at /tmp/build_php-5.6.5.Xhp/php-5.6.5/ext/spl/spl_iterators.c:1657
      No locals.
      #5  0x00000000006ce6b5 in spl_dual_it_rewind (intern=0x2b00ef0) at /tmp/build_php-5.6.5.Xhp/php-5.6.5/ext/spl/spl_iterators.c:1681
      No locals.
      #6  0x00000000006ce9ed in zim_spl_dual_it_rewind (ht=0, return_value=0x2adc2a0, return_value_ptr=0x7fffeac79170, this_ptr=0x27c8460, return_value_used=1)
          at /tmp/build_php-5.6.5.Xhp/php-5.6.5/ext/spl/spl_iterators.c:1749
              intern = 0x2b00ef0
      

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: