From b84719cf0ba9a62b846881be5098597b71e18fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Thu, 3 Sep 2026 21:01:57 +0200 Subject: [PATCH 1/2] phpize: Use cp -f when copying build files Many PHP installations, for example Homebrew, Nix and distribution packages, install lib/php/build/* and run-tests.php read-only. Plain cp creates the destination with the source mode on the first phpize run. On later runs in the same project, cp cannot open the read-only destination for writing and fails with "Permission denied". cp -f unlinks and recreates the destination, so it only needs write permission on the directory, not on the target file. --- scripts/phpize.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/phpize.in b/scripts/phpize.in index 4e9db6ec415e..3a9046076162 100644 --- a/scripts/phpize.in +++ b/scripts/phpize.in @@ -148,8 +148,8 @@ phpize_copy_files() { test -d build || mkdir build - (cd "$phpdir" && cp $FILES_BUILD "$builddir"/build) - (cd "$phpdir" && cp $FILES "$builddir") + (cd "$phpdir" && cp -f $FILES_BUILD "$builddir"/build) + (cd "$phpdir" && cp -f $FILES "$builddir") } phpize_replace_prefix() From 19f2a178b64a1d6fa9f4bc1363b1a5fe7ba72731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Thu, 3 Sep 2026 21:02:05 +0200 Subject: [PATCH 2/2] phpize: Fail when build files cannot be copied Both cp calls run in subshells with no status check, and phpize_copy_files is called unconditionally, so phpize exits 0 even when the copy fails. The extension is then configured with stale files left over from a previous run. After a PHP upgrade in place, this silently builds against the previous PHP's php.m4, Makefile.global and run-tests.php. Propagate the failure with "|| exit 1", matching the style already used in phpize_autotools(). --- scripts/phpize.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/phpize.in b/scripts/phpize.in index 3a9046076162..8e99fa1d6d6c 100644 --- a/scripts/phpize.in +++ b/scripts/phpize.in @@ -148,8 +148,8 @@ phpize_copy_files() { test -d build || mkdir build - (cd "$phpdir" && cp -f $FILES_BUILD "$builddir"/build) - (cd "$phpdir" && cp -f $FILES "$builddir") + (cd "$phpdir" && cp -f $FILES_BUILD "$builddir"/build) || exit 1 + (cd "$phpdir" && cp -f $FILES "$builddir") || exit 1 } phpize_replace_prefix()