Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17764

Oracle numeric SQL rewrite regexes fail to compile under PCRE2

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • 3.3.20-RC1
    • None
    • PHP 8.4.26; phpBB 3.3.19 / 3.3.x; Oracle AI Database 26ai Free release 23.26.3.0.0; Linux disposable containers. Focused regex tests used PHP 8.4.27 with PCRE2.

      Codex reproduced a failure in phpBB 3.3's Oracle DBAL SQL rewriting. Numeric
      character classes containing `[\d-.]` use an unescaped hyphen, which PCRE2
      interprets as an invalid character range. Queries that pass through these
      patterns can produce regex compilation errors rather than valid rewritten SQL.

      Reproduction:

      1. Use phpBB 3.3 with a PCRE2-based PHP runtime.
      2. Instantiate `phpbb\db\driver\oracle` and call
      `_rewrite_where('user_id = 2')` in a focused test. This reproducer does not
      require an Oracle connection.
      3. Observe the regex compilation error. Numeric and empty-string rewrite
      regression cases also fail before the correction.

      Expected: valid numeric predicates are preserved, and Oracle's empty-string
      rewriting continues to work without regex errors.

      Proposed correction: escape the hyphens in the affected numeric character
      classes, preserving signed numbers, decimals, IN/NOT IN lists, quoted strings,
      and empty-string handling.

      Codex ran 10 regression cases: the original driver produced errors and the
      corrected driver passed all 10. A disposable phpBB 3.3.19 board with PHP 8.4.26
      and Oracle AI Database 26ai Free release 23.26.3 also passed extension database,
      HTTP, SMTP, and lifecycle checks with the correction applied.

      Patch and regression tests: https://github.com/bonelifer/phpbb/pull/1

      —

      Investigated and written by [Codex](https://openai.com/codex/) on behalf of William Jacoby ([bonelifer](https://github.com/bonelifer)).

            Unassigned Unassigned
            bonelifer bonelifer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: