Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-679

Check presence and type of operation args in unified spec tests

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.9.0
    • Affects Version/s: None
    • Component/s: None
    • None

      As noted in PHPLIB-592:

      PHP 8 upgraded some former notices into warnings (https://www.php.net/manual/en/migration80.incompatible.php). Accessing an undefined array key was one such upgrade. This creates a potential issue for Operation::assert() in the unified spec test runner, since warnings were previously captured specifically to ensure expectError assertions catch stream errors in GridFS.

      One valid-fail test for load balancer support (schema version 1.3; PHPLIB-669) is expecting an error due to a missing operation arg (see: ignoreResultAndError: malformed operation fails if ignoreResultAndError is true).

      The existing test runner implementation accesses required parameters without checking that the key exists. When a key does not exist, PHP 7.x raises a noise while PHP 8.x raises a warning. In both cases, the test would fail; however, this will cause an issue with ignoreResultAndError since PHPLIB-592 requires that we allow expectError a chance to inspect warnings (due to how GridFS stream errors are currently raised).

      A proper work-around for this will entail explicitly asserting both the presence and type of required operation args before we access them. The, we can safely rely on PHPUnit assertion failures instead of differing behavior in PHP itself.

            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: