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

Disable SKIPIF caching for skip_if_not_clean on PHP 8.1

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

      As of PHP 8.1, run-tests.php now caches SKIPIF evaluation by default. SKIPIF blocks are cached by a combination of their source code and test file directory. This is particularly problematic for PHPC since we use SKIPIF to drop collections before a test, and having run-tests.php defer to a cache entry means that code will not run before a test (inviting unexpected errors like duplicate key exceptions).

      SKIPIF sections can opt out of caching by emitting "nocache" before any other output. In that case, run-tests.php circumvents caching, replaces the output with an empty string, and allows the test to run unskipped. There appears to be no way to out of caching and skip a test, which conceivably means that an unexpected skip (e.g. unexpected error dropping a collection) could lead to more tests being skipped than intended. My thread on php-internals goes into that in more detail, but at present there appears to be no workaround.

      In any event, a basic solution to avoid caching-related test failures will be to have skip_if_not_clean conditionally emit "nocache" on success. And we'll need to gate that logic for PHP 8.1, since unexpected SKIPIF output could leak to borked tests in earlier PHP versions.

            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: