Skip to content

Fix GH-25023: ZEND_CONTAINER_OF() fails to compile with -std=c11 - #25027

Merged
arnaud-lb merged 3 commits into
php:PHP-8.6from
lazerg:fix/gh-25023-container-of-typeof
Oct 29, 2026
Merged

arnaud-lb merged 3 commits into
php:PHP-8.6from
lazerg:fix/gh-25023-container-of-typeof

Conversation

@lazerg

@lazerg lazerg commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

ZEND_CONTAINER_OF() uses typeof on the ZEND_GCC_VERSION branch, but GCC and Clang only accept that spelling in GNU mode or C23. With -std=c11/-std=c17 any extension that includes one of the headers using the macro (e.g. ext/pdo/php_pdo_driver.h) fails to build. This adds ZEND_TYPEOF(), which is typeof on C23 and __typeof__ on GCC/Clang otherwise, and uses it in the macro.

Fixes #25023

@TimWolla

Copy link
Copy Markdown
Member

Interesting, I was of the impression that we already required GNU mode to build successfully. Since __typeof__ is an extension it might not work for the __STDC_VERSION__ case, no? We'll likely need a ZEND_TYPEOF(). This will also make it easy to clean up once C23 becomes the minimum.

@lazerg

lazerg commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Done

@TimWolla
TimWolla requested a review from arnaud-lb October 29, 2026 08:09
@arnaud-lb
arnaud-lb merged commit e5e5a8a into php:PHP-8.6 Oct 29, 2026
1 check passed
arnaud-lb added a commit that referenced this pull request Oct 29, 2026
* PHP-8.6:
  Fix GH-25023: ZEND_CONTAINER_OF() fails to compile with -std=c11 (#25027)
@arnaud-lb

Copy link
Copy Markdown
Member

Thank you!

arnaud-lb added a commit to lazerg/php-src that referenced this pull request Oct 29, 2026
* up/PHP-8.6:
  Fix json_encode() reporting false "Recursion detected" after OOM for hooked-property objects (php#24992)
  Fix phpGH-25023: ZEND_CONTAINER_OF() fails to compile with -std=c11 (php#25027)
  Fix flaky FPM test for bug #77023 (php#24999)
  Update GitHub Action workflows to `actions/checkout@v7` (8.6)
  Update GitHub Action workflows to `actions/checkout@v7` (8.5)
  Update GitHub Action workflows to `actions/checkout@v7` (8.4)
  Update GitHub Action workflows to `actions/checkout@v7`
  Fix phpGH-23626: OPcache: orphaned temporaries cause leaks and assertions
  [ci skip] Fix comment
  Fix block pass dropping ZEND_FAST_CALL OP2 definition
  Fix phpGH-23572: JIT calls wrong static method from trait clones
  Fix phpGH-24784: Preserve certificates when reading PKCS7/CMS CRLs (php#24785)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants