Skip to content

[PHP] Add TSRMLS_CC fallback defines for PHP versions above 7#3512

Merged
mho22 merged 2 commits intotrunkfrom
tsrmls-compilation-for-php-7-and-above
Apr 22, 2026
Merged

[PHP] Add TSRMLS_CC fallback defines for PHP versions above 7#3512
mho22 merged 2 commits intotrunkfrom
tsrmls-compilation-for-php-7-and-above

Conversation

@mho22
Copy link
Copy Markdown
Collaborator

@mho22 mho22 commented Apr 20, 2026

Motivation for the change, related issues

Add PHP 5.2 WebAssembly builds and runtime support added TSRMLS_CC macros to dns_polyfill and post_message_to_js for PHP 5.x compatibility, but these macros don't exist in PHP 7+. This breaks recompilation of PHP.wasm for all PHP versions 7.0 through 8.5.

Implementation details

Added empty TSRMLS_CC fallback defines to dns_polyfill.c and post_message_to_js.c

Testing Instructions (or ideally a Blueprint)

  • nx run php-wasm-node:recompile-php:jspi
  • nx run php-wasm-node:recompile-php:asyncify
  • nx run php-wasm-web:recompile-php:jspi
  • nx run php-wasm-web:recompile-php:asyncify

@mho22 mho22 marked this pull request as ready for review April 21, 2026 05:39
@mho22 mho22 requested review from a team, Copilot and zaerl April 21, 2026 05:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR restores compatibility across PHP 7+ builds by adding empty fallback definitions for legacy TSRMLS_CC macros introduced for PHP 5.x support.

Changes:

  • Add empty TSRMLS_CC fallback defines in dns_polyfill.c and post_message_to_js.c when the macro is missing (PHP 7+).
  • Update the bundled Node asyncify PHP 8.4 build metadata from 8.4.19 to 8.4.20 (WASM path/version/size and related generated offsets).

Reviewed changes

Copilot reviewed 4 out of 59 changed files in this pull request and generated 3 comments.

File Description
packages/php-wasm/node-builds/8-4/asyncify/php_8_4.js Bumps embedded PHP 8.4 runtime metadata/version and updates generated constants/offsets.
packages/php-wasm/compile/php-wasm-dns-polyfill/dns_polyfill.c Adds TSRMLS_CC empty fallback for PHP 7+ compatibility.
packages/php-wasm/compile/php-post-message-to-js/post_message_to_js.c Adds TSRMLS_CC empty fallback for PHP 7+ compatibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/php-wasm/node-builds/8-4/asyncify/php_8_4.js Outdated
Comment thread packages/php-wasm/compile/php-wasm-dns-polyfill/dns_polyfill.c
Comment thread packages/php-wasm/compile/php-post-message-to-js/post_message_to_js.c Outdated
@mho22 mho22 force-pushed the tsrmls-compilation-for-php-7-and-above branch from 5a7cc94 to 222d633 Compare April 21, 2026 13:05
@mho22 mho22 requested review from JanJakes and removed request for zaerl April 21, 2026 13:55
Copy link
Copy Markdown
Member

@JanJakes JanJakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

Comment thread packages/php-wasm/compile/php-post-message-to-js/post_message_to_js.c Outdated
mho22 added a commit that referenced this pull request Apr 21, 2026
This pull request is part of #3512

Compiling PHP.wasm Node and Web.
@mho22 mho22 force-pushed the tsrmls-compilation-for-php-7-and-above branch from 2ffda56 to ef5eb71 Compare April 21, 2026 19:47
@mho22 mho22 merged commit ee35972 into trunk Apr 22, 2026
139 of 140 checks passed
@mho22 mho22 deleted the tsrmls-compilation-for-php-7-and-above branch April 22, 2026 10:01
mho22 added a commit that referenced this pull request Apr 24, 2026
This pull request is part of
#3512

Compiling PHP.wasm Node and Web.

This is the second attempt since [the first
one](#3513) was
merged directly inside #3512 which hit the same issue as when you
recompile PHP.wasm directly inside a PR.

And it looks like even this is not possible. We will probably need to
Compile Node and Web separately.

<img width="830" height="764" alt="Capture d’écran 2026-04-22 à 15 16
22"
src="https://github.com/user-attachments/assets/c7277772-4c05-4b36-8e66-5ae558b35a83"
/>
mho22 added a commit that referenced this pull request Apr 24, 2026
This pull request is part of
#3512 and #3518

Compiling PHP.wasm Web.

This is the second attempt since
#3513 was merged
directly inside
#3512 which hit
the same issue as when you recompile PHP.wasm directly inside a PR.
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