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

Cannot use object of type Person as array

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

      The array passed in bsonUnserialize() is an type hinted array, and you can foreach over it..
      But if you try to use it later, it will be of the same type as the current class.

      <?php
      class Address implements BSON\Persistable {
          protected $streetAddress;
          protected $city;
          protected $postalCode;
      
          function __construct($streetAddress, $city, $postalCode) {
              $this->streetAddress = $streetAddress;
              $this->city          = $city;
              $this->postalCode    = $postalCode;
      
          }
          function bsonUnserialize(array $array) {
              foreach($array as $k => $v) {
                  $this->{$k} = $v;
              }
      
              return $this;
          }
      
          function bsonSerialize() {
              return get_object_vars($this);
          }
      }
      
      class Person implements BSON\Persistable {
          protected $_id;
          protected $username;
          protected $email;
          protected $name;
          protected $addresses = array();
          protected $_lastModified;
          protected $_created;
      
          function __construct($username, $email, $name) {
              $this->username = $username;
              $this->email    = $email;
              $this->setName($name);
      
              /* Pregenerate our ObjectID */
              $this->_id     = new BSON\ObjectID();
          }
          function addAddress(Address $address) {
              $this->addresses[] = $address;
          }
      
          function bsonUnserialize(array $array) {
              $this->__original = $array;
              foreach($array as $k => $v) {
                  $this->{$k} = $v;
              }
          }
      
          function bsonSerialize() {
              $props = get_object_vars($this);
      
              /* If __original doesn't exist, this is a fresh object that needs to be inserted */
              if (empty($this->__original)) {
                  $props["_created"] = new BSON\UTCDatetime(microtime(true) * 1000);
                  return $props;
              }
      
              /* Track the last time this person was updated */
              $update = array(
                  '$currentDate' => array(
                      "_lastModified" => array('$type' => 'date'),
                  ),
                  '$set' => array(),
              );
              /* Otherwise, only pluck out the changes so we don't have to do full object replacement */
              foreach($props as $k => $v) {
                  if (!isset($this->__original[$k])) {
                      /* A new field -- likely a on-the-fly schema upgrade */
                      $updated['$set'] = array($k => $v);
                  }
              }
          }
      
          function getName() {
              return $this->name;
          }
          function setName($name) {
              return $this->name = $name;
          }
      }
      
      
      $lair77 = new Person('lair77', 'claire77@example.net', 'Claire Corwin');
      $hillardhaven = new Address('4527 Kohler Square Apt. 316', 'Hillardhaven', '02622-5175');
      $lair77->addAddress($hillardhaven);
      $prudencemouth = new Address('7042 Freida Springs', 'Prudencemouth', '94805');
      $lair77->addAddress($prudencemouth);
      
      
      $tabitha = new Person('tabitha.mohr', 'mohr@example.org', 'Tabitha Lehner');
      $konopelskichester = new Address('76650 Mina Pass', 'Konopelskichester', '69679-5471');
      $tabitha->addAddress($konopelskichester);
      
      $hartmann = new Person('hartmann', 'hartmann@example.org', 'Hartmann Dedrick');
      $leannefurt = new Address('151 Delbert Hills Suite 923', 'Leannefurt', '22036');
      $hartmann->addAddress($leannefurt);
      
      $ena = new Person('ena', 'ena.sanford@example.net', 'Frida Sanford'); 
      $lawsonport = new Address('3656 Jenifer Field', 'New Lawsonport', '16300');
      $ena->addAddress($lawsonport);
      
      
      $lockman = new Person('cartwright.garland', 'lockman.olga@example.net', 'Alice Carter');
      $herminia = new Address('37413 Kailee Spurs', 'East Herminia', '22107');
      $lockman->addAddress($herminia);
      
      
      $dropcoll = new MongoDB\Driver\Command(array("drop" => "people"));
      $query = new MongoDB\Driver\Query(array());
      $hartmannFilter = array("username" => "hartmann");
      $queryHartmann = new MongoDB\Driver\Query($hartmannFilter);
      
      
      $bulk = new MongoDB\Driver\BulkWrite;
      $bulk->insert($lair77);
      $bulk->insert($tabitha);
      $bulk->insert($hartmann);
      $bulk->insert($ena);
      $bulk->insert($lockman);
      
      $m = new MongoDB\Driver\Manager("mongodb://localhost");
      try {
          $m->executeCommand("examples", $dropcoll);
      } catch(Exception $e) {}
      
      $m->executeBulkWrite("examples.people", $bulk);
      
      
      foreach($m->executeQuery("examples.people", $query) as $person) {
          var_dump($person->getName());
      }
      
      echo "-----\n";
      
      $hartmann = $m->executeQuery("examples.people", $queryHartmann)->toArray()[0];
      var_dump($hartmann->getName());
      $hartmann->setName("Dr. " . $hartmann->getName());
      
      $retval = $m->executeUpdate("examples.people", $hartmannFilter, $hartmann);
      var_dump($retval);
      
      string(13) "Claire Corwin"
      string(14) "Tabitha Lehner"
      string(16) "Hartmann Dedrick"
      string(13) "Frida Sanford"
      string(12) "Alice Carter"
      -----
      string(16) "Hartmann Dedrick"
      
      Fatal error: Cannot use object of type Person as array in /home/bjori/Sources/phongo/ods.php on line 72
      
      ==16788== 4 bytes in 1 blocks are indirectly lost in loss record 2 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x8053FB: _estrndup (zend_alloc.c:2650)
      ==16788==    by 0x8544E6: zend_hash_get_current_key_zval_ex (zend_hash.c:1106)
      ==16788==    by 0x8A7EC3: ZEND_FE_FETCH_SPEC_VAR_HANDLER (zend_vm_execute.h:14010)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788== 
      ..
      ==16788== 30 bytes in 2 blocks are indirectly lost in loss record 15 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x8053FB: _estrndup (zend_alloc.c:2650)
      ==16788==    by 0x845A53: add_assoc_stringl_ex (zend_API.c:1295)
      ==16788==    by 0x7500B79: php_phongo_bson_visit_utf8 (bson.c:200)
      ==16788==    by 0x752CBB2: bson_iter_visit_all (bson-iter.c:1729)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are still reachable in loss record 26 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x757DD1F: php_phongo_cursor_iterator_rewind (php_phongo.c:1677)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x840163: zend_execute_scripts (zend.c:1344)
      ==16788==    by 0x7A3C17: php_execute_script (main.c:2584)
      ==16788==    by 0x8FAE57: do_cli (php_cli.c:994)
      ..
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 29 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x7500DC7: php_phongo_bson_visit_oid (bson.c:245)
      ==16788==    by 0x752CE4D: bson_iter_visit_all (bson-iter.c:1784)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 30 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x7501E22: php_phongo_bson_visit_array (bson.c:498)
      ==16788==    by 0x752CCFE: bson_iter_visit_all (bson-iter.c:1757)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 31 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x7501AFA: php_phongo_bson_visit_document (bson.c:470)
      ==16788==    by 0x752CC58: bson_iter_visit_all (bson-iter.c:1743)
      ==16788==    by 0x7501EB2: php_phongo_bson_visit_array (bson.c:501)
      ==16788==    by 0x752CCFE: bson_iter_visit_all (bson-iter.c:1757)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 32 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x8455CC: add_assoc_null_ex (zend_API.c:1239)
      ==16788==    by 0x7501074: php_phongo_bson_visit_null (bson.c:284)
      ==16788==    by 0x752CF4F: bson_iter_visit_all (bson-iter.c:1805)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 33 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x7500F61: php_phongo_bson_visit_date_time (bson.c:270)
      ==16788==    by 0x752CF07: bson_iter_visit_all (bson-iter.c:1798)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 34 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x88FE7B: ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4070)
      ==16788==    by 0x89010B: ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4133)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 32 bytes in 1 blocks are indirectly lost in loss record 35 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x89B98C: ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9393)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788== 
      ...
      ==16788== 64 bytes in 1 blocks are indirectly lost in loss record 44 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x805102: _safe_emalloc (zend_alloc.c:2583)
      ==16788==    by 0x805255: _ecalloc (zend_alloc.c:2610)
      ==16788==    by 0x851650: _zend_hash_add_or_update (zend_hash.c:255)
      ==16788==    by 0x8406BA: zend_symtable_update (zend_hash.h:359)
      ==16788==    by 0x845AE1: add_assoc_zval_ex (zend_API.c:1303)
      ==16788==    by 0x85936B: zif_get_object_vars (zend_builtin_functions.c:1026)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x88CF92: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2595)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788== 
      ==16788== 64 bytes in 1 blocks are indirectly lost in loss record 45 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x805102: _safe_emalloc (zend_alloc.c:2583)
      ==16788==    by 0x805255: _ecalloc (zend_alloc.c:2610)
      ==16788==    by 0x8523DE: _zend_hash_index_update_or_next_insert (zend_hash.c:392)
      ==16788==    by 0x840682: zend_symtable_update (zend_hash.h:358)
      ==16788==    by 0x845AE1: add_assoc_zval_ex (zend_API.c:1303)
      ==16788==    by 0x7501C14: php_phongo_bson_visit_document (bson.c:473)
      ==16788==    by 0x752CC58: bson_iter_visit_all (bson-iter.c:1743)
      ==16788==    by 0x7501EB2: php_phongo_bson_visit_array (bson.c:501)
      ==16788==    by 0x752CCFE: bson_iter_visit_all (bson-iter.c:1757)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788== 
      ==16788== 64 bytes in 1 blocks are indirectly lost in loss record 46 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x805102: _safe_emalloc (zend_alloc.c:2583)
      ==16788==    by 0x805255: _ecalloc (zend_alloc.c:2610)
      ==16788==    by 0x851CF7: _zend_hash_quick_add_or_update (zend_hash.c:320)
      ==16788==    by 0x890005: ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4102)
      ==16788==    by 0x89010B: ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4133)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788== 
      ==16788== 64 bytes in 2 blocks are indirectly lost in loss record 47 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x8459E3: add_assoc_stringl_ex (zend_API.c:1294)
      ==16788==    by 0x7500B79: php_phongo_bson_visit_utf8 (bson.c:200)
      ==16788==    by 0x752CBB2: bson_iter_visit_all (bson-iter.c:1729)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788== 
      ==16788== 64 bytes in 2 blocks are indirectly lost in loss record 48 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x89B98C: ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9393)
      ==16788==    by 0x89BC04: ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9462)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      
      ....
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 54 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x84499F: _array_init (zend_API.c:1011)
      ==16788==    by 0x7501E86: php_phongo_bson_visit_array (bson.c:499)
      ==16788==    by 0x752CCFE: bson_iter_visit_all (bson-iter.c:1757)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788==    by 0x7509D5B: zim_Cursor_toArray (Cursor.c:102)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 55 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x8526EC: _zend_hash_index_update_or_next_insert (zend_hash.c:419)
      ==16788==    by 0x840682: zend_symtable_update (zend_hash.h:358)
      ==16788==    by 0x845AE1: add_assoc_zval_ex (zend_API.c:1303)
      ==16788==    by 0x7501C14: php_phongo_bson_visit_document (bson.c:473)
      ==16788==    by 0x752CC58: bson_iter_visit_all (bson-iter.c:1743)
      ==16788==    by 0x7501EB2: php_phongo_bson_visit_array (bson.c:501)
      ==16788==    by 0x752CCFE: bson_iter_visit_all (bson-iter.c:1757)
      ==16788==    by 0x750422A: bson_to_zval (bson.c:839)
      ==16788==    by 0x757DDB0: php_phongo_cursor_iterator_rewind (php_phongo.c:1678)
      ==16788==    by 0x6C134D: spl_iterator_apply (spl_iterators.c:3512)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 56 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x84499F: _array_init (zend_API.c:1011)
      ==16788==    by 0x859242: zif_get_object_vars (zend_builtin_functions.c:1013)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x88CF92: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2595)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 57 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x8519B0: _zend_hash_add_or_update (zend_hash.c:283)
      ==16788==    by 0x8406BA: zend_symtable_update (zend_hash.h:359)
      ==16788==    by 0x845AE1: add_assoc_zval_ex (zend_API.c:1303)
      ==16788==    by 0x8593B2: zif_get_object_vars (zend_builtin_functions.c:1029)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x88CF92: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2595)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 58 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x84499F: _array_init (zend_API.c:1011)
      ==16788==    by 0x8900FF: ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4128)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 59 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x852042: _zend_hash_quick_add_or_update (zend_hash.c:346)
      ==16788==    by 0x890005: ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4102)
      ==16788==    by 0x89010B: ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER (zend_vm_execute.h:4133)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 60 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x84499F: _array_init (zend_API.c:1011)
      ==16788==    by 0x8D709D: ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER (zend_vm_execute.h:28956)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 72 bytes in 1 blocks are indirectly lost in loss record 61 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x852042: _zend_hash_quick_add_or_update (zend_hash.c:346)
      ==16788==    by 0x89BAFE: ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9431)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 128 bytes in 2 blocks are indirectly lost in loss record 69 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x805102: _safe_emalloc (zend_alloc.c:2583)
      ==16788==    by 0x805255: _ecalloc (zend_alloc.c:2610)
      ==16788==    by 0x851CF7: _zend_hash_quick_add_or_update (zend_hash.c:320)
      ==16788==    by 0x89BAFE: ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9431)
      ==16788==    by 0x89BC04: ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9462)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788== 
      ==16788== 128 bytes in 1 blocks are definitely lost in loss record 70 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x757DF3F: php_phongo_malloc (php_phongo.c:1720)
      ==16788==    by 0x75336DB: bson_malloc (bson-memory.c:67)
      ==16788==    by 0x75276C7: bson_new (bson.c:1877)
      ==16788==    by 0x750B88F: zim_Manager_executeUpdate (Manager.c:204)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x840163: zend_execute_scripts (zend.c:1344)
      ==16788==    by 0x7A3C17: php_execute_script (main.c:2584)
      ==16788== 
      ==16788== 128 bytes in 1 blocks are definitely lost in loss record 71 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x757DF3F: php_phongo_malloc (php_phongo.c:1720)
      ==16788==    by 0x75336DB: bson_malloc (bson-memory.c:67)
      ==16788==    by 0x75276C7: bson_new (bson.c:1877)
      ==16788==    by 0x750B8AD: zim_Manager_executeUpdate (Manager.c:205)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x840163: zend_execute_scripts (zend.c:1344)
      ==16788==    by 0x7A3C17: php_execute_script (main.c:2584)
      ==16788== 
      ==16788== 144 bytes in 2 blocks are indirectly lost in loss record 73 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x84499F: _array_init (zend_API.c:1011)
      ==16788==    by 0x89BBF8: ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9457)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 144 bytes in 2 blocks are indirectly lost in loss record 74 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x852042: _zend_hash_quick_add_or_update (zend_hash.c:346)
      ==16788==    by 0x89BAFE: ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9431)
      ==16788==    by 0x89BC04: ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER (zend_vm_execute.h:9462)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788== 
      ....
      ==16788== 964 (64 direct, 900 indirect) bytes in 2 blocks are definitely lost in loss record 112 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x883E0D: zend_assign_tmp_to_variable (zend_execute.c:834)
      ==16788==    by 0x8E8173: ZEND_ASSIGN_SPEC_CV_TMP_HANDLER (zend_vm_execute.h:35235)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      ==16788== 
      ==16788== 1,316 (32 direct, 1,284 indirect) bytes in 1 blocks are definitely lost in loss record 120 of 140
      ==16788==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==16788==    by 0x804EB4: _emalloc (zend_alloc.c:2427)
      ==16788==    by 0x887459: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:551)
      ==16788==    by 0x88CF92: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2595)
      ==16788==    by 0x886B84: execute_ex (zend_vm_execute.h:363)
      ==16788==    by 0x886C0D: zend_execute (zend_vm_execute.h:388)
      ==16788==    by 0x82A18F: zend_call_function (zend_execute_API.c:832)
      ==16788==    by 0x861A70: zend_call_method (zend_interfaces.c:62)
      ==16788==    by 0x7503B2F: zval_to_bson (bson.c:738)
      ==16788==    by 0x750B90C: zim_Manager_executeUpdate (Manager.c:207)
      ==16788==    by 0x887515: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:558)
      ==16788==    by 0x887CEC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:693)
      

      Not sure how much of that is because of the fatal error, but at least a start

            Assignee:
            bjori Hannes Magnusson
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: