mod_php_install.sh: fix PHP 8.1.34 build after applying security patches.

The patches change sources of generated files (Zend/zend_vm_def.h,
*.re) together with the generated files. Patching left the sources
newer, so make re-ran zend_vm_gen.php with the host's php binary,
producing a broken Zend/zend_vm_opcodes.h ("operator '==' has no left
operand"). Touch the generated files after patching so they are taken
as up to date.

sury-9 changes pdo_sql_parser.re and url_scanner_ex.re without the
generated *.c files, so these fixes needed re2c to be built. Add
php-8.1.34-sury-9-re2c-generated.patch, which applies the same changes
to the generated *.c files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrisandClaude Opus 5.5 committed 2026-11-20 13:00:40 +01:00
1 parent 985d073613
commit 9ca1942a50
2 files changed
+80 -1

No files matched your search

+35 -1
View File
@@ -6404,6 +6404,10 @@ fi
# - php-8.1.34-cve-2026-109618-109619.patch # - php-8.1.34-cve-2026-109618-109619.patch
# - php-8.1.34-sury-9.patch (backports from 8.2.x, Debian/sury) # - php-8.1.34-sury-9.patch (backports from 8.2.x, Debian/sury)
# - php-8.1.34-cve-2026-129291.patch (php-fpm) # - php-8.1.34-cve-2026-129291.patch (php-fpm)
# - php-8.1.34-sury-9-re2c-generated.patch
# - (own patch: the *.re hunks of sury-9 for pdo_sql_parser and
# - url_scanner_ex applied to the generated *.c files, so the fixes
# - are built without re2c)
# - # -
# - Order matters: the CVE-2026-109618/109619 patch MUST be applied before # - Order matters: the CVE-2026-109618/109619 patch MUST be applied before
# - 'php-8.1.34-sury-9.patch', otherwise hunk #4 of main/rfc1867.c fails. # - 'php-8.1.34-sury-9.patch', otherwise hunk #4 of main/rfc1867.c fails.
@@ -6419,7 +6423,8 @@ if [[ "$VERSION" = "8.1.34" ]]; then
for _patch_file in \ for _patch_file in \
php-8.1.34-cve-2026-109618-109619.patch \ php-8.1.34-cve-2026-109618-109619.patch \
php-8.1.34-sury-9.patch \ php-8.1.34-sury-9.patch \
php-8.1.34-cve-2026-129291.patch ; do php-8.1.34-cve-2026-129291.patch \
php-8.1.34-sury-9-re2c-generated.patch ; do
echononl "\tApply ${_patch_file}" echononl "\tApply ${_patch_file}"
if [[ ! -f "${_srcdir}/${_patch_file}" ]] ; then if [[ ! -f "${_srcdir}/${_patch_file}" ]] ; then
echo_failed echo_failed
@@ -6437,6 +6442,35 @@ if [[ "$VERSION" = "8.1.34" ]]; then
fatal "$(cat $tmp_err_msg)" fatal "$(cat $tmp_err_msg)"
fi fi
done done
# - The patches change sources of generated files (Zend/zend_vm_def.h,
# - *.re) together with the generated files themselves. Patching leaves
# - the sources with a newer mtime, so make would regenerate the files:
# - zend_vm_gen.php is run with the php binary installed on the host,
# - which produces a broken Zend/zend_vm_opcodes.h ("operator '==' has
# - no left operand" for ZEND_VM_KIND), and re2c might be missing.
# -
# - The generated files shipped in the tarball and fixed by the patches
# - are correct, so mark them as up to date.
# -
echononl "\tMark generated files (Zend VM, re2c) as up to date"
_gen_ok=true
for _gen_file in \
Zend/zend_vm_execute.h \
Zend/zend_vm_opcodes.h \
Zend/zend_vm_opcodes.c \
ext/date/lib/parse_date.c \
ext/date/lib/parse_iso_intervals.c \
ext/pdo/pdo_sql_parser.c \
ext/standard/url_scanner_ex.c ; do
touch "${_srcdir}/php-${VERSION}/${_gen_file}" > $tmp_err_msg 2>&1 || _gen_ok=false
done
if $_gen_ok ; then
echo_ok
else
echo_failed
fatal "$(cat $tmp_err_msg)"
fi
else else
echononl "\tApply PHP 8.1.34 security patches" echononl "\tApply PHP 8.1.34 security patches"
echo_skipped echo_skipped
+45
View File
@@ -0,0 +1,45 @@
# Generated-file counterpart of the ext/pdo/pdo_sql_parser.re and
# ext/standard/url_scanner_ex.re hunks of php-8.1.34-sury-9.patch
# (so the fixes are built without re2c). Apply with -p1 after sury-9.
diff -ru a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c
--- a/ext/pdo/pdo_sql_parser.c 2026-11-20 12:59:33.025497677 +0100
+++ b/ext/pdo/pdo_sql_parser.c 2026-11-20 12:59:33.065925906 +0100
@@ -392,7 +392,7 @@
if (t == PDO_PARSER_BIND) {
ptrdiff_t len = s.cur - s.tok;
- if ((ZSTR_VAL(inquery) < (s.cur - len)) && isalnum(*(s.cur - len - 1))) {
+ if ((ZSTR_VAL(inquery) < (s.cur - len)) && isalnum((unsigned char)s.cur[-len - 1])) {
continue;
}
query_type |= PDO_PLACEHOLDER_NAMED;
diff -ru a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c
--- a/ext/standard/url_scanner_ex.c 2026-11-20 12:59:33.044057656 +0100
+++ b/ext/standard/url_scanner_ex.c 2026-11-20 12:59:33.067960258 +0100
@@ -86,7 +86,7 @@
*val++ = '\0';
for (q = key; *q; q++) {
- *q = tolower(*q);
+ *q = tolower((unsigned char)*q);
}
keylen = q - key;
str = zend_string_init(key, keylen, 1);
@@ -135,7 +135,7 @@
char *q;
for (q = key; *q; q++) {
- *q = tolower(*q);
+ *q = tolower((unsigned char)*q);
}
keylen = q - key;
if (keylen > 0) {
@@ -449,7 +449,7 @@
}
smart_str_appendl(&ctx->tag, start, YYCURSOR - start);
for (i = 0; i < ZSTR_LEN(ctx->tag.s); i++)
- ZSTR_VAL(ctx->tag.s)[i] = tolower((int)(unsigned char)ZSTR_VAL(ctx->tag.s)[i]);
+ ZSTR_VAL(ctx->tag.s)[i] = tolower((unsigned char)ZSTR_VAL(ctx->tag.s)[i]);
/* intentionally using str_find here, in case the hash value is set, but the string val is changed later */
if ((ctx->lookup_data = zend_hash_str_find_ptr(ctx->tags, ZSTR_VAL(ctx->tag.s), ZSTR_LEN(ctx->tag.s))) != NULL) {
ok = 1;