ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 1.21.14, 2.5.8, 2.1.14
    • Affects Version/s: None
    • Component/s: None
    • None
    • 2
    • None
    • PHP Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      The v1.21 branch no longer builds on ubuntu-latest since the GitHub runner image moved from Ubuntu 24.04 to Ubuntu 26.04 on 2026-11-16. The new image ships GCC 15, which defaults to C23. In C23, strchr() keeps the const qualifier of its argument, so this line fails with -Werror:

      src/phongo_util.c:131:21: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
        131 |         char* dot = strchr(namespace, '.');
      

      Three CI jobs fail on every pull request targeting the branch: Out-of-source Build, Static PHP Build (in-source) and Test PECL package. Static PHP Build (out-of-source) is cancelled as a result. This blocks all pull requests to v1.21, including the Dependabot updates.

      Fix

      Declare the result as const char* and use the pointer directly. The behavior is unchanged.

      const char* dot = strchr(namespace, '.');
      
      if (!dot) {
          return false;
      }
      
      if (cname) {
          *cname = estrdup(dot + 1);
      }
      if (dbname) {
          *dbname = estrndup(namespace, dot - namespace);
      }
      

      Verification

      The developer flags build, which includes -Werror, succeeds on:* Ubuntu 22.04, GCC 11.4, PHP 8.1

      • Ubuntu 24.04, GCC 13.3, PHP 8.3

      On Ubuntu 26.04 (GCC 15.2), the unpatched file reproduces the CI error and the patched file compiles.

            Assignee:
            Jérôme Tamarelle
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: