diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78d4ae7d..b8906ada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: stack: - scalingo-22 - scalingo-24 + - scalingo-26 container: image: "scalingo/${{ matrix.stack }}:latest" env: diff --git a/Makefile b/Makefile index 4e27bdaa..303d2ca5 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,13 @@ BASH_COMMAND := /bin/bash .DEFAULT := all all: test -test: test22 test24 +test: test22 test24 test26 test24: STACK := "scalingo-24" +test26: STACK := "scalingo-26" -test22 test24: BASH_COMMAND := test/run -test22 test24: IMAGE := "scalingo/$(STACK):latest" -test22 test24: +test22 test24 test26: BASH_COMMAND := test/run +test22 test24 test26: IMAGE := "scalingo/$(STACK):latest" +test22 test24 test26: @echo "Running tests in Docker using $(IMAGE)" @docker run --pull always --mount type=bind,src=$(PWD),dst=/buildpack,readonly --workdir /buildpack --rm --interactive --tty --env "GITLAB_TOKEN=$(GITLAB_TOKEN)" --env "GITHUB_TOKEN=$(GITHUB_TOKEN)" --env "STACK=$(STACK)" $(IMAGE) bash -c "$(BASH_COMMAND)" diff --git a/conf/versions.sh b/conf/versions.sh index 73e3c028..76af3430 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -34,7 +34,7 @@ librabbitmq_version="0.15.0" memcached_version="3.4.0" gmp_version="6.3.0" -tidy_version="5.8.0" +libtidy_version="5.8.0" sodium_version="1.0.22" webp_version="${webp_version:-1.6.0}" # Can be found here: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html # From https://zlib.net/ @@ -46,7 +46,7 @@ mongodb_version="1.21.5" amqp_version="2.2.0" phpredis_version="6.3.0" apcu_version="5.1.28" -newrelic_version="12.5.0.30" +newrelic_version="12.7.0.36" # Legacy support diff --git a/lib/composer b/lib/composer index b3b9faf5..173d1448 100644 --- a/lib/composer +++ b/lib/composer @@ -154,7 +154,7 @@ function install_composer_deps() { elif [ "$ext" = "gmp" ] ; then fetch_package "$PHP_BASE_URL" "gmp-${gmp_version}" "/app/vendor/gmp" | indent elif [ "$ext" = "tidy" ] ; then - fetch_package "$PHP_BASE_URL" "libtidy-${tidy_version}" "/app/vendor/libtidy" | indent + fetch_package "$PHP_BASE_URL" "libtidy-${libtidy_version}" "/app/vendor/libtidy" | indent elif [ "$ext" = "sodium" ] ; then if [[ "$(php_api_version)" -lt "${PHP_MODULE_API_VERSIONS["7.4"]}" ]] ; then sodium_version=$sodium_php72_php73_version diff --git a/support/ext-internal/tidy b/support/ext-internal/tidy index 4aeddc7e..e68c9aa2 100755 --- a/support/ext-internal/tidy +++ b/support/ext-internal/tidy @@ -1,9 +1,12 @@ #!/bin/bash +# +# Compile the Tidy PHP extension (https://www.php.net/manual/en/book.tidy.php). The outcome is a .so file that is uploaded to the object storage. This file is downloaded during the deployment if a customer enables the Tidy extension. +# set -e if [ -n "$DEBUG" ]; then - set -x + set -x fi php_version=$1 @@ -11,12 +14,12 @@ zend_api_version=$2 php_src_dir=$3 source "/buildpack/conf/versions.sh" -tidy_package="${PHP_BASE_URL}/package/libtidy-${tidy_version}.tgz" +tidy_package="${PHP_BASE_URL}/package/libtidy-${libtidy_version}.tgz" -curl -L "$tidy_package" > /tmp/tidy-${tidy_version}.tgz +curl --location "$tidy_package" > /tmp/tidy-${libtidy_version}.tgz -mkdir -p /app/vendor/libtidy -tar -xzv -C /app/vendor/libtidy -f /tmp/tidy-${tidy_version}.tgz +mkdir --parents /app/vendor/libtidy +tar --extract --gzip --directory=/app/vendor/libtidy --file=/tmp/tidy-${libtidy_version}.tgz pushd $php_src_dir/php-${php_version}/ext/tidy export PATH=$PATH:/app/vendor/php/bin @@ -30,4 +33,3 @@ cp modules/tidy.so "$EXT_DIR" popd echo "extension=tidy.so" > "$PREFIX/etc/conf.d/tidy.ini" - diff --git a/support/ext/amqp b/support/ext/amqp index d1bfc844..a341e372 100755 --- a/support/ext/amqp +++ b/support/ext/amqp @@ -229,4 +229,3 @@ echo "extension=amqp.so" > "${PREFIX}/etc/conf.d/amqp.ini" # Cleanup cleanup_amqp - diff --git a/support/ext/mongodb b/support/ext/mongodb index 9b241536..ad915c92 100755 --- a/support/ext/mongodb +++ b/support/ext/mongodb @@ -26,6 +26,11 @@ curl --location "${url}" \ pushd "mongodb-${mongodb_version}" +if [ "$STACK" = "scalingo-26" ] && [ "${zend_api_version}" -ge "${PHP_MODULE_API_VERSIONS['8.5']}" ]; then + echo "Apply the patch to fix a call to IS_INTERNED" + patch -p1 < /buildpack/support/ext/mongodb-is-interned.patch +fi + if ! /app/vendor/php/bin/phpize; then echo "Fail to PHPize mongodb extension" exit 1 diff --git a/support/ext/mongodb-is-interned.patch b/support/ext/mongodb-is-interned.patch new file mode 100644 index 00000000..30ec3b5b --- /dev/null +++ b/support/ext/mongodb-is-interned.patch @@ -0,0 +1,13 @@ +diff --git a/src/contrib/php_array_api.h b/src/contrib/php_array_api.h +index 5a97337..5e88c5c 100644 +--- a/src/contrib/php_array_api.h ++++ b/src/contrib/php_array_api.h +@@ -350,7 +350,7 @@ char *php_array_zval_to_string(zval *z, int *plen, zend_bool *pfree) { + zval c = *z; + zval_copy_ctor(&c); + convert_to_string(&c); +- *pfree = ! IS_INTERNED(Z_STR(c)); ++ *pfree = ! ZSTR_IS_INTERNED(Z_STR(c)); + *plen = Z_STRLEN(c); + return Z_STRVAL(c); + } diff --git a/support/get_gmp b/support/get_gmp index 81fbb06a..9f58e183 100755 --- a/support/get_gmp +++ b/support/get_gmp @@ -25,7 +25,9 @@ curl --fail --location "https://gmplib.org/download/gmp/gmp-${gmp_version}.tar.x mkdir -p /app/vendor/gmp pushd "gmp-${gmp_version}" > /dev/null -./configure --prefix=/app/vendor/gmp +# We need the `CC` flag since gcc v15 (used in scalingo-26). +# gcc v15 default C mode changed to C23 which made the configuration fails. A fix is already written but not yet published. Hence the `CC` flag may be deleted in the next releases. +./configure --prefix=/app/vendor/gmp CC="gcc -std=gnu17" make make check make install diff --git a/support/get_libc_client b/support/get_libc_client index 2dd54f36..506b327e 100755 --- a/support/get_libc_client +++ b/support/get_libc_client @@ -45,6 +45,11 @@ elif [[ "${deps_stack}" = "scalingo-24" ]]; then "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.debian.tar.xz" "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.dsc" ) +elif [[ "${deps_stack}" = "scalingo-26" ]]; then + dep_urls+=( + "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.debian.tar.xz" + "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.dsc" + ) fi echo "-----> Downloading libc-client ${dep_version}" diff --git a/support/get_libtidy b/support/get_libtidy new file mode 100755 index 00000000..dbe1e28b --- /dev/null +++ b/support/get_libtidy @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# +# This script downloads the libtidy version specified in libtidy_version. It compiles it and upload it to an object storage. Libtidy is eventually used when packaging the Tidy PHP extension (`support/ext-internal/tidy`), and during the deployment of a new PHP application (https://github.com/Scalingo/php-buildpack/blob/03f4e8f45bcff5dd307c23549d7c725b9ba63dff/lib/composer#L156-L157). +# +# This script must only be called in the context of the release of a new stack (https://www.notion.so/scalingooriginal/New-Stack-PHP-Support-d1e5370e886f41f492050a7a7536217f). +# + +set -e +if [ -n "$DEBUG" ]; then + set -x +fi + +which cmake 2>/dev/null || (apt-get update && apt-get install -y cmake) + +basedir="$( cd -P "$( dirname "$0" )" && pwd )" + +# The variable is assigned in `versions.sh` +declare libtidy_version +source "$basedir/../conf/versions.sh" +source "$basedir/lib/utils" +source "$basedir/lib/swift" + +tempdir=$(mktmpdir libtidy) +cd "$tempdir" + +echo "-----> Downloading libtidy v${libtidy_version}" +curl --fail --location --remote-name "https://github.com/htacg/tidy-html5/archive/${libtidy_version}.tar.gz" + +tar xvf "${libtidy_version}.tar.gz" +cd "tidy-html5-${libtidy_version}" +mkdir --parents /app/vendor/libtidy + +cd build/cmake +# The flag `-DCMAKE_POLICY_VERSION_MINIMUM=3.5` is mandatory for the call to CMake to succeed with versions available in scalingo-26 and more recent. +cmake ../.. -DCMAKE_INSTALL_PREFIX=/app/vendor/libtidy -DTIDY_COMPAT_HEADERS=true -DCMAKE_POLICY_VERSION_MINIMUM=3.5 +make +make install + +cd "$tempdir" +mkdir package +cd package +tar -C /app/vendor/libtidy -czvf "libtidy-${libtidy_version}.tgz" . +cd .. + +swift_upload "package/libtidy-${libtidy_version}.tgz" + +"$basedir/package-checksum" "libtidy-${libtidy_version}" diff --git a/support/get_tidy b/support/get_tidy deleted file mode 100755 index bc41795e..00000000 --- a/support/get_tidy +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e -if [ -n "$DEBUG" ]; then - set -x -fi - -which cmake 2>/dev/null || (apt-get update && apt-get install -y cmake) - -basedir="$( cd -P "$( dirname "$0" )" && pwd )" - -# The variable is assigned in `versions.sh` -declare tidy_version -source "$basedir/../conf/versions.sh" -source "$basedir/lib/utils" -source "$basedir/lib/swift" - -tempdir=$(mktmpdir libtidy) -cd "$tempdir" - -echo "-----> Downloading Tidy v${tidy_version}" -curl --fail --location --remote-name "https://github.com/htacg/tidy-html5/archive/${tidy_version}.tar.gz" - -tar xvf "${tidy_version}.tar.gz" -cd "tidy-html5-${tidy_version}" -mkdir /app/vendor/libtidy - -cd build/cmake -cmake ../.. -DCMAKE_INSTALL_PREFIX=/app/vendor/libtidy -DTIDY_COMPAT_HEADERS=true -make -make install - -cd "$tempdir" -mkdir package -cd package -tar -C /app/vendor/libtidy -czvf "libtidy-${tidy_version}.tgz" . -cd .. - -swift_upload "package/libtidy-${tidy_version}.tgz" - -"$basedir/package-checksum" "libtidy-${tidy_version}" diff --git a/support/package_all b/support/package_all index 0542a5a2..4ee2b1b7 100755 --- a/support/package_all +++ b/support/package_all @@ -29,9 +29,12 @@ source "../conf/versions.sh" # skip=( "imap" "igbinary" ) +echo "Compile the extensions for PHP $php_version" + for e in ./ext-internal/*; do ext_name="$( basename "${e}" )" + # For PHP 8.4 and more recent, we want to skip some extensions if [[ "${PHP_MODULE_API_VERSIONS["${php_version}"]}" -ge 20240924 ]] \ && [[ ${skip[@]} =~ "${ext_name}" ]] then @@ -48,6 +51,7 @@ done for e in ./ext/*; do ext_name="$( basename "${e}" )" + # For PHP 8.4 and more recent, we want to skip some extensions if [[ "${PHP_MODULE_API_VERSIONS["${php_version}"]}" -ge 20240924 ]] \ && [[ ${skip[@]} =~ "${ext_name}" ]] then diff --git a/test/defaults b/test/defaults index 57f6a713..1073a44b 100644 --- a/test/defaults +++ b/test/defaults @@ -17,6 +17,12 @@ default_nginx["scalingo-24"]="1.30." default_composer["scalingo-24"]="2.9." latest_composer["scalingo-24"]="2.9.8" +# Defaults for scalingo-26: +default_php["scalingo-26"]="8.4." +default_nginx["scalingo-26"]="1.30." +default_composer["scalingo-26"]="2.9." +latest_composer["scalingo-26"]="2.9.8" + test::defaults::classic() { #