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

Refactor option parsing for execute methods

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0-beta1, 1.4.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Do not allow case-insensitive options in execute functions

      phongo_execute_parse_options() currently iterates through the options array and uses strcasecmp() to check for each option. The case-insensitivity appears to have been copied over from URI option handling. While URI options are case-insensitive, I don't believe we allow case-insensitive options anywhere else (e.g. Query).

      Switching to php_array API for accessing the options will enforce case-sensitive names. We will then rely on PHPC-1066 to warn users about unknown/unsupported options.

      Refactor Manager to select server before calling phongo_execute functions

      Currently, the phongo_execute functions may be called with and without a server hint. Having the execute methods in Manager.c select a server in advance would simplify the phongo_execute code paths. Additionally, that selection code could then be shared with Manager::selectServer().

      Since libmongoc 1.9.0 supports a "serverId" option in its with_opts() functions and bulk write API, we can consistently pass the server hint directly for all of our execute methods (write, command, and query).

            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: