12
12
;
13
13
def is_alpine:
14
14
env.from | startswith("alpine")
15
+ ;
16
+ def rcVersion:
17
+ env.version | rtrimstr("-rc")
18
+ ;
19
+ def need_patch_11678:
20
+ # https://github.com/docker-library/php/pull/1552
21
+ # https://github.com/php/php-src/issues/11678 "Build fails on musl 1.2.4 - lfs64" stream_cookie_seeker
22
+ # https://github.com/php/php-src/issues/14834 "Error installing PHP when --with-pear is used" xml errors
23
+ is_alpine and rcVersion == "8.1"
24
+ ;
25
+ def need_patch_18743:
26
+ # https://github.com/docker-library/php/pull/1580
27
+ # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c"
28
+ env.variant == "zts" # only needed for ZTS builds
29
+ and is_alpine
30
+ and (env.from != "alpine:3.21") # only needed for Alpine 3.22+
31
+ and (
32
+ IN(rcVersion; "8.1", "8.2")
33
+ or IN(.version; "8.3.22", "8.4.8") # https://github.com/docker-library/php/pull/1580#issuecomment-2955259172
34
+ )
15
35
-}}
16
36
FROM {{ env.from }}
17
37
@@ -190,7 +210,7 @@ ENV GPG_KEYS {{
190
210
"39B6 4134 3D8C 104B 2B14 6DC3 F9C3 9DC0 B969 8544", # ramsey
191
211
"F1F6 9223 8FBC 1666 E5A5 CCD4 199F 9DFE F6FF BAFD" # patrickallaert
192
212
],
193
- }[env.version | rtrimstr("-rc") ] // error("missing GPG keys for " + env.version )
213
+ }[rcVersion ] // error("missing GPG keys for " + rcVersion )
194
214
| map(gsub(" "; ""))
195
215
| join(" ")
196
216
}}
@@ -261,8 +281,8 @@ RUN set -eux; \
261
281
"libsodium-dev",
262
282
"libxml2-dev",
263
283
"openssl-dev",
264
- # https://github.com/docker-library/php/pull/1552
265
- if env.version | rtrimstr("-rc") == "8.1" then "patch", "patchutils" else empty end,
284
+ # https://github.com/docker-library/php/pull/1552 (11678) & https://github.com/docker-library/php/pull/1580 (14834)
285
+ if need_patch_11678 or need_patch_18743 then "patch", "patchutils" else empty end,
266
286
"readline-dev",
267
287
"sqlite-dev",
268
288
# https://github.com/docker-library/php/issues/888
@@ -306,7 +326,7 @@ RUN set -eux; \
306
326
; \
307
327
docker-php-source extract; \
308
328
cd /usr/src/php; \
309
- {{ if is_alpine and (env.version | rtrimstr("-rc") == "8.1") then ( -}}
329
+ {{ if need_patch_11678 then ( -}}
310
330
# Apply patches; see https://github.com/docker-library/php/pull/1552
311
331
# https://github.com/php/php-src/issues/11678
312
332
curl -fL 'https://github.com/php/php-src/commit/577b8ae4226368e66fee7a9b5c58f9e2428372fc.patch?full_index=1' -o 11678.patch; \
@@ -318,6 +338,23 @@ RUN set -eux; \
318
338
echo 'ed10a1b254091ad676ed204e55628ecbd6c8962004d6185a1821cedecd526c0f *14834.patch' | sha256sum -c -; \
319
339
filterdiff -x '*/NEWS' 14834.patch | patch -p1; \
320
340
rm 14834.patch; \
341
+ {{ ) else "" end -}}
342
+ {{
343
+ if need_patch_18743 then
344
+ # https://github.com/docker-library/php/pull/1580#issuecomment-2957191901
345
+ {
346
+ "8.1": { url: "https://github.com/php/php-src/commit/6b105d4bc57e20a2472c9a6ff11fba32768556d4.patch?full_index=1", sha256: "037e1610ae5d444e9a8c3ecd9d5f0cd215fd0aac90bdd7b9f0b259bffdf3566b" },
347
+ "8.4": { url: "https://github.com/php/php-src/commit/4c7220322bc74b0fc8416e1958cadd7bc51fe1b7.diff?full_index=1", sha256: "a19e795b24c52d4d1aa3d45b67339e1b62a5365b37cf4418b83e2709fc98bcb5" },
348
+ }[rcVersion]
349
+ // { url: "https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1", sha256: "b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5" }
350
+ | (
351
+ -}}
352
+ # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c"
353
+ # https://github.com/docker-library/php/pull/1580
354
+ curl -fL {{ .url | @sh }} -o 18743.patch; \
355
+ echo {{ "\(.sha256) *18743.patch" | @sh }} | sha256sum -c -; \
356
+ filterdiff -x '*/NEWS' 18743.patch | patch -p1; \
357
+ rm 18743.patch; \
321
358
{{ ) else "" end -}}
322
359
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
323
360
{{ if is_alpine then "" else ( -}}
@@ -341,7 +378,7 @@ RUN set -eux; \
341
378
# https://github.com/docker-library/php/issues/822
342
379
--with-pic \
343
380
\
344
- {{ if env.version | rtrimstr("-rc") == "8.1" then ( -}}
381
+ {{ if rcVersion == "8.1" then ( -}}
345
382
# --enable-ftp is included here for compatibility with existing versions. ftp_ssl_connect() needed ftp to be compiled statically before PHP 7.0 (see https://github.com/docker-library/php/issues/236).
346
383
--enable-ftp \
347
384
{{ ) else "" end -}}
@@ -375,7 +412,7 @@ RUN set -eux; \
375
412
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear")
376
413
--with-pear \
377
414
\
378
- {{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
415
+ {{ if rcVersion | IN("8.1", "8.2") then ( -}}
379
416
# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+)
380
417
# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c
381
418
# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib
@@ -412,7 +449,7 @@ RUN set -eux; \
412
449
--enable-zts \
413
450
# https://externals.io/message/118859
414
451
--disable-zend-signals \
415
- {{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
452
+ {{ if rcVersion | IN("8.1", "8.2") then ( -}}
416
453
--enable-zend-max-execution-timers \
417
454
{{ ) else "" end -}}
418
455
{{ ) else "" end -}}
0 commit comments