12
12
;
13
13
def is_alpine:
14
14
env.from | contains("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
@@ -205,7 +225,7 @@ ENV GPG_KEYS="{{
205
225
"2C16 C765 DBE5 4A08 8130 F1BC 4B9B 5F60 0B55 F3B4", # carusogabriel
206
226
"39B6 4134 3D8C 104B 2B14 6DC3 F9C3 9DC0 B969 8544" # ramsey
207
227
],
208
- }[env.version | rtrimstr("-rc") ] // error("missing GPG keys for " + env.version )
228
+ }[rcVersion ] // error("missing GPG keys for " + rcVersion )
209
229
| map(gsub(" "; ""))
210
230
| join(" ")
211
231
}}"
@@ -278,8 +298,8 @@ RUN set -eux; \
278
298
"libxml2-dev",
279
299
if env.version == "8.0" then "libzip-dev" else empty end,
280
300
if env.version == "8.0" then "openssl1.1-compat-dev" else "openssl-dev" end,
281
- # https://github.com/docker-library/php/pull/1552
282
- if env.version | rtrimstr("-rc") == "8.1" then "patch", "patchutils" else empty end,
301
+ # https://github.com/docker-library/php/pull/1552 (11678) & https://github.com/docker-library/php/pull/1580 (14834)
302
+ if need_patch_11678 or need_patch_18743 then "patch", "patchutils" else empty end,
283
303
"readline-dev",
284
304
"sqlite-dev",
285
305
# https://github.com/docker-library/php/issues/888
@@ -323,7 +343,7 @@ RUN set -eux; \
323
343
; \
324
344
docker-php-source extract; \
325
345
cd /usr/src/php; \
326
- {{ if is_alpine and (env.version | rtrimstr("-rc") == "8.1") then ( -}}
346
+ {{ if need_patch_11678 then ( -}}
327
347
# Apply patches; see https://github.com/docker-library/php/pull/1552
328
348
# https://github.com/php/php-src/issues/11678
329
349
curl -fL 'https://github.com/php/php-src/commit/577b8ae4226368e66fee7a9b5c58f9e2428372fc.patch?full_index=1' -o 11678.patch; \
@@ -335,6 +355,23 @@ RUN set -eux; \
335
355
echo 'ed10a1b254091ad676ed204e55628ecbd6c8962004d6185a1821cedecd526c0f *14834.patch' | sha256sum -c -; \
336
356
filterdiff -x '*/NEWS' 14834.patch | patch -p1; \
337
357
rm 14834.patch; \
358
+ {{ ) else "" end -}}
359
+ {{
360
+ if need_patch_18743 then
361
+ # https://github.com/docker-library/php/pull/1580#issuecomment-2957191901
362
+ {
363
+ "8.1": { url: "https://github.com/php/php-src/commit/6b105d4bc57e20a2472c9a6ff11fba32768556d4.patch?full_index=1", sha256: "037e1610ae5d444e9a8c3ecd9d5f0cd215fd0aac90bdd7b9f0b259bffdf3566b" },
364
+ "8.4": { url: "https://github.com/php/php-src/commit/4c7220322bc74b0fc8416e1958cadd7bc51fe1b7.diff?full_index=1", sha256: "a19e795b24c52d4d1aa3d45b67339e1b62a5365b37cf4418b83e2709fc98bcb5" },
365
+ }[rcVersion]
366
+ // { url: "https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1", sha256: "b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5" }
367
+ | (
368
+ -}}
369
+ # https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c"
370
+ # https://github.com/docker-library/php/pull/1580
371
+ curl -fL {{ .url | @sh }} -o 18743.patch; \
372
+ echo {{ "\(.sha256) *18743.patch" | @sh }} | sha256sum -c -; \
373
+ filterdiff -x '*/NEWS' 18743.patch | patch -p1; \
374
+ rm 18743.patch; \
338
375
{{ ) else "" end -}}
339
376
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
340
377
{{ if is_alpine then "" else ( -}}
@@ -358,7 +395,7 @@ RUN set -eux; \
358
395
# https://github.com/docker-library/php/issues/822
359
396
--with-pic \
360
397
\
361
- {{ if env.version | rtrimstr("-rc") == "8.0" then ( -}}
398
+ {{ if rcVersion == "8.0" then ( -}}
362
399
# --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).
363
400
--enable-ftp \
364
401
{{ ) else "" end -}}
@@ -395,7 +432,7 @@ RUN set -eux; \
395
432
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear")
396
433
--with-pear \
397
434
\
398
- {{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
435
+ {{ if rcVersion | IN("8.1", "8.2") then ( -}}
399
436
# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+)
400
437
# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c
401
438
# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib
@@ -433,7 +470,7 @@ RUN set -eux; \
433
470
--enable-zts \
434
471
# https://externals.io/message/118859
435
472
--disable-zend-signals \
436
- {{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
473
+ {{ if rcVersion | IN("8.1", "8.2") then ( -}}
437
474
--enable-zend-max-execution-timers \
438
475
{{ ) else "" end -}}
439
476
{{ ) else "" end -}}
0 commit comments