Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/registry/php/build-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ cd "$SRC_DIR"
# Apply patches for Wasm compatibility
echo "==> Patching PHP for Wasm..."

# Rewrite zend_compile_short_circuiting and zend_compile_binary_op to
# walk left-leaning same-kind chains iteratively. The recursive form
# overflows wasm engines' tight per-frame stack budget on long chains.
# Idempotency: the rewrite introduces the helper zend_compile_binary_op_emit,
# which is absent from upstream php-src.
if ! grep -q 'zend_compile_binary_op_emit' Zend/zend_compile.c; then
patch -p1 < "$SCRIPT_DIR/patches/iterative-chain-compile.patch"
fi

# Disable inline assembly in Zend (safety net — Wasm doesn't match arch guards anyway)
if ! grep -q 'ZEND_USE_ASM_ARITHMETIC 0' Zend/zend_multiply.h 2>/dev/null; then
if [ -f Zend/zend_multiply.h ]; then
Expand Down
2 changes: 1 addition & 1 deletion packages/registry/php/build.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
script_path = "packages/registry/php/build-php.sh"
repo_url = "https://github.com/brandonpayton/kandelo.git"
commit = "8c53383229fab78f97b098c3207a655159c03041"
revision = 3
revision = 4

[binary]
index_url = "https://github.com/Automattic/kandelo/releases/download/binaries-abi-v{abi}/index.toml"
Loading
Loading