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

WriteConcernError->getInfo() can be scalar

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

      The content of errInfo depends on the `code`. It is not always an array. It is also optional and therefore needs to be treated as such.

      #0  0x00007ffff5674847 in zval_addref_p (pz=0x0) at /usr/local/p/versions/5.5.17/include/php/Zend/zend.h:370
      #1  0x00007ffff567524b in php_phongo_writeconcernerror_get_debug_info (object=0x143cd50, is_temp=0x7fffffffa7d4, tsrm_ls=0x119d010) at /home/bjori/Sources/phongo/src/MongoDB/WriteConcernError.c:186
      #2  0x00000000007f1228 in php_var_dump (struc=0x1408218, level=1, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/ext/standard/var.c:129
      #3  0x00000000007f165a in zif_var_dump (ht=1, return_value=0x143cd80, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/ext/standard/var.c:183
      #4  0x0000000000953420 in zend_do_fcall_common_helper_SPEC (execute_data=0x1408150, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/Zend/zend_vm_execute.h:550
      #5  0x0000000000958f25 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x1408150, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/Zend/zend_vm_execute.h:2332
      #6  0x000000000095274b in execute_ex (execute_data=0x1408150, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/Zend/zend_vm_execute.h:363
      #7  0x0000000000952834 in zend_execute (op_array=0x143bf30, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/Zend/zend_vm_execute.h:388
      #8  0x000000000090a47c in zend_execute_scripts (type=8, tsrm_ls=0x119d010, retval=0x0, file_count=3) at /usr/local/p/src/5.5.17/Zend/zend.c:1330
      #9  0x0000000000848ef8 in php_execute_script (primary_file=0x7fffffffcee0, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/main/main.c:2506
      #10 0x00000000009d3a6a in do_cli (argc=2, argv=0x119cf20, tsrm_ls=0x119d010) at /usr/local/p/src/5.5.17/sapi/cli/php_cli.c:994
      #11 0x00000000009d5077 in main (argc=2, argv=0x119cf20) at /usr/local/p/src/5.5.17/sapi/cli/php_cli.c:1378
      
      <?php
      
      $manager = new MongoDB\Driver\Manager("mongodb://localhost");
      
      $wc = new MongoDB\Driver\WriteConcern("MultipleDC", 500);
      
      $doc = array("example" => "document");
      try {
          $result = $manager->executeInsert("databaseName.collectionName", $doc, $wc);
      } catch(MongoDB\Driver\Exception $e) {
          var_dump(get_class($e), $e->getMessage());
      }
      var_dump($result->getWriteConcernError());
      

      Expected:

      object(MongoDB\Driver\WriteConcernError)#4 (3) {
        ["message"]=>
        string(75) "No write concern mode named 'MultipleDC' found in replica set configuration"
        ["code"]=>
        int(79)
        ["info"]=>
        NULL
      }
      

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

              Created:
              Updated:
              Resolved: