From a7085df872120f59877e40e864fd4721e185d624 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Jul 2026 17:58:26 +0000 Subject: [PATCH 1/2] Fix silently-broken PHP 8.6 redis build phpredis git master started calling zend_bin2hex(), a Zend API only added in PHP 8.6.0alpha2, while builds were pinned to the older 8.6.0alpha1 base image. The compile failure went unnoticed because the git-source install blocks (redis, igbinary, mailparse, imagick) chained their build steps with a trailing `;` instead of `&&` before writing the extension ini file, so a failed `make` didn't stop the script from still enabling the (non-existent) extension. - Bump the 8.6 base image to 8.6.0alpha2, which now provides zend_bin2hex(). - Pin phpredis to a commit verified to build against it, since its unpinned HEAD tracks php-src's development branch closely. - Chain each git-source build fully through the ini write with &&, so a failed build now aborts the script instead of silently continuing. --- .github/workflows/buildx.yml | 2 +- .github/workflows/test.yml | 2 +- php-install.sh | 83 +++++++++++++++++++----------------- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index 6a8188d..fa01958 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -60,7 +60,7 @@ jobs: run: | USE_VERSION=$PHP_VERSION if [ "$PHP_VERSION" == "8.6" ]; then - USE_VERSION="8.6.0alpha1" + USE_VERSION="8.6.0alpha2" fi echo "name=$USE_VERSION" >> "$GITHUB_OUTPUT" - name: Build and push Docker image diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d9232a..a1af8da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,7 +51,7 @@ jobs: if: matrix.php-version == '8.6' run: docker build -t php-base --build-arg PHP_VERSION=$PHP_VERSION . env: - PHP_VERSION: '8.6.0alpha1' + PHP_VERSION: '8.6.0alpha2' - name: Pull main image for size comparison id: pull_main diff --git a/php-install.sh b/php-install.sh index 4d5e302..baac3e9 100644 --- a/php-install.sh +++ b/php-install.sh @@ -99,23 +99,23 @@ esac case $PHP_VERSION in 8.5*) - php -m | grep -q '^igbinary$' || \ - (git clone --depth=1 https://github.com/igbinary/igbinary.git /usr/src/igbinary; \ - cd /usr/src/igbinary; \ - phpize && ./configure && make -j"$(nproc)" && make install; \ - echo "extension=igbinary.so" > /usr/local/etc/php/conf.d/igbinary.ini; \ - cd -; \ - rm -rf /usr/src/igbinary) + php -m | grep -q '^igbinary$' || ( + git clone --depth=1 https://github.com/igbinary/igbinary.git /usr/src/igbinary && + cd /usr/src/igbinary && + phpize && ./configure && make -j"$(nproc)" && make install && + echo "extension=igbinary.so" > /usr/local/etc/php/conf.d/igbinary.ini + ) + rm -rf /usr/src/igbinary ;; 8.6*) - php -m | grep -q '^igbinary$' || \ - (git clone --depth=1 https://github.com/igbinary/igbinary.git /usr/src/igbinary; \ - cd /usr/src/igbinary; \ - export CFLAGS="${CFLAGS:-} -DXtOffsetOf=offsetof -Dzval_dtor=zval_ptr_dtor_nogc"; \ - phpize && ./configure && make -j"$(nproc)" && make install; \ - echo "extension=igbinary.so" > /usr/local/etc/php/conf.d/igbinary.ini; \ - cd -; \ - rm -rf /usr/src/igbinary) + php -m | grep -q '^igbinary$' || ( + git clone --depth=1 https://github.com/igbinary/igbinary.git /usr/src/igbinary && + cd /usr/src/igbinary && + export CFLAGS="${CFLAGS:-} -DXtOffsetOf=offsetof -Dzval_dtor=zval_ptr_dtor_nogc" && + phpize && ./configure && make -j"$(nproc)" && make install && + echo "extension=igbinary.so" > /usr/local/etc/php/conf.d/igbinary.ini + ) + rm -rf /usr/src/igbinary ;; *) yes | pecl install igbinary @@ -124,14 +124,14 @@ esac case $PHP_VERSION in 8.5*|8.6*) - # Yknow if we really need it. - php -m | grep -q '^mailparse$' || \ - (git clone --depth=1 https://github.com/php/pecl-mail-mailparse.git /usr/src/mailparse; \ - cd /usr/src/mailparse; \ - phpize && ./configure && make -j"$(nproc)" && make install; \ - echo "extension=mailparse.so" > /usr/local/etc/php/conf.d/mailparse.ini; \ - cd -; \ - rm -rf /usr/src/mailparse) + # Yknow if we really need it. + php -m | grep -q '^mailparse$' || ( + git clone --depth=1 https://github.com/php/pecl-mail-mailparse.git /usr/src/mailparse && + cd /usr/src/mailparse && + phpize && ./configure && make -j"$(nproc)" && make install && + echo "extension=mailparse.so" > /usr/local/etc/php/conf.d/mailparse.ini + ) + rm -rf /usr/src/mailparse ;; *) yes | pecl install mailparse @@ -220,13 +220,18 @@ esac case $PHP_VERSION in 8.5*|8.6*) - php -m | grep -q '^redis$' || \ - (git clone --depth=1 https://github.com/phpredis/phpredis.git /usr/src/phpredis; \ - cd /usr/src/phpredis; \ - phpize && ./configure && make -j"$(nproc)" && make install; \ - echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini; \ - cd -; \ - rm -rf /usr/src/phpredis) + php -m | grep -q '^redis$' || ( + git clone --depth=1 https://github.com/phpredis/phpredis.git /usr/src/phpredis && + cd /usr/src/phpredis && + # Pin to a commit verified to build against the current PHP 8.6 base image. + # phpredis tracks php-src's development branch closely, so its unpinned HEAD + # can (and has) broken against whatever alpha/beta of 8.6 we're building. + # Bump this hash when moving to a newer 8.6 pre-release. + git checkout e3273a90fe0521de4c35a7410e186be68b70dff6 && + phpize && ./configure && make -j"$(nproc)" && make install && + echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini + ) + rm -rf /usr/src/phpredis ;; 8.*) mkdir -p /usr/src/php/ext/redis && curl -fsSL https://pecl.php.net/get/redis | tar xvz -C "/usr/src/php/ext/redis" --strip 1 && docker-php-ext-install redis @@ -298,15 +303,15 @@ esac case $PHP_VERSION in 8.6*) - php -m | grep -q '^imagick$' || \ - (git clone --depth=1 https://github.com/Imagick/imagick.git /usr/src/imagick; \ - cd /usr/src/imagick; \ - export CFLAGS="${CFLAGS:-} -DXtOffsetOf=offsetof"; \ - phpize && ./configure && make -j"$(nproc)" && make install; \ - echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini; \ - cd -; \ - rm -rf /usr/src/imagick) - ;; + php -m | grep -q '^imagick$' || ( + git clone --depth=1 https://github.com/Imagick/imagick.git /usr/src/imagick && + cd /usr/src/imagick && + export CFLAGS="${CFLAGS:-} -DXtOffsetOf=offsetof" && + phpize && ./configure && make -j"$(nproc)" && make install && + echo "extension=imagick.so" > /usr/local/etc/php/conf.d/imagick.ini + ) + rm -rf /usr/src/imagick + ;; *) yes | pecl install imagick ;; From 35d7daf0fa770b85b864232b8a63fcf341bacaec Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 18 Jul 2026 18:10:07 +0000 Subject: [PATCH 2/2] Drop phpredis commit pin, keep unpinned git master Rely on the alpha2 base bump plus the fail-fast && chain instead of pinning to a specific commit. --- php-install.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/php-install.sh b/php-install.sh index baac3e9..4ed5b3d 100644 --- a/php-install.sh +++ b/php-install.sh @@ -223,11 +223,6 @@ case $PHP_VERSION in php -m | grep -q '^redis$' || ( git clone --depth=1 https://github.com/phpredis/phpredis.git /usr/src/phpredis && cd /usr/src/phpredis && - # Pin to a commit verified to build against the current PHP 8.6 base image. - # phpredis tracks php-src's development branch closely, so its unpinned HEAD - # can (and has) broken against whatever alpha/beta of 8.6 we're building. - # Bump this hash when moving to a newer 8.6 pre-release. - git checkout e3273a90fe0521de4c35a7410e186be68b70dff6 && phpize && ./configure && make -j"$(nproc)" && make install && echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini )