Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
stack:
- scalingo-22
- scalingo-24
- scalingo-26
container:
image: "scalingo/${{ matrix.stack }}:latest"
env:
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
4 changes: 2 additions & 2 deletions conf/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/composer
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions support/ext-internal/tidy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: this file is not required anymore for scalingo-26, but is it for older stacks?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I restored this file.

Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#!/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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: <3

#

set -e

if [ -n "$DEBUG" ]; then
set -x
set -x
fi

php_version=$1
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
Expand All @@ -30,4 +33,3 @@ cp modules/tidy.so "$EXT_DIR"
popd

echo "extension=tidy.so" > "$PREFIX/etc/conf.d/tidy.ini"

1 change: 0 additions & 1 deletion support/ext/amqp
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,3 @@ echo "extension=amqp.so" > "${PREFIX}/etc/conf.d/amqp.ini"
# Cleanup

cleanup_amqp

5 changes: 5 additions & 0 deletions support/ext/mongodb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: I love how you handled this <3

fi

if ! /app/vendor/php/bin/phpize; then
echo "Fail to PHPize mongodb extension"
exit 1
Expand Down
13 changes: 13 additions & 0 deletions support/ext/mongodb-is-interned.patch
Original file line number Diff line number Diff line change
@@ -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);
}
4 changes: 3 additions & 1 deletion support/get_gmp
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: shall we have a conditional here for stacks < scalingo-26? (or does it work?)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Even though the default changed in gcc, the flag -std=gnu17 is supported by all gcc versions since a long time.

I double checked by executing this script in the scalingo-22 container and I confirm it works.

# 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
Expand Down
5 changes: 5 additions & 0 deletions support/get_libc_client
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
47 changes: 47 additions & 0 deletions support/get_libtidy
Original file line number Diff line number Diff line change
@@ -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

@EtienneM EtienneM May 29, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The flag -DCMAKE_POLICY_VERSION_MINIMUM=3.5 is mandatory starting with scalingo-26, but it works whatever the stack.

It is mandatory or we face the error:

CMake Error at CMakeLists.txt:20 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.

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}"
41 changes: 0 additions & 41 deletions support/get_tidy

This file was deleted.

4 changes: 4 additions & 0 deletions support/package_all

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: thanks for adding the comments 👍

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/defaults
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
#
Expand Down