Skip to content

Commit 5c63251

Browse files
committed
feat(php): Add PHP 8.5 support
1 parent 935a2d2 commit 5c63251

File tree

12 files changed

+339
-177
lines changed

12 files changed

+339
-177
lines changed

.github/action/musl/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_VERSION=8.4
1+
ARG PHP_VERSION=8.5
22
ARG TS=-zts
33

44
FROM php:${PHP_VERSION}${TS}-alpine

.github/workflows/build.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
strategy:
8888
matrix:
8989
os: [ubuntu-latest, macos-latest, windows-latest]
90-
php: ["8.1", "8.2", "8.3", "8.4"]
90+
php: ["8.1", "8.2", "8.3", "8.4", "8.5"]
9191
rust: [stable, nightly]
9292
clang: ["15", "17"]
9393
phpts: [ts, nts]
@@ -173,20 +173,17 @@ jobs:
173173
runs-on: ubuntu-latest
174174
env:
175175
clang: "17"
176-
php_version: "8.4"
176+
php_version: "8.5"
177177
steps:
178178
- name: Checkout code
179179
uses: actions/checkout@v5
180180

181-
- name: Setup PHP
182-
uses: shivammathur/setup-php@v2
183-
with:
184-
php-version: ${{ env.php_version }}
185-
env:
186-
debug: true
187-
188-
- name: Install libphp-embed
189-
run: sudo apt update -y && sudo apt install -y libphp8.4-embed
181+
- name: Install libphp-embed from sury.org
182+
run: |
183+
sudo curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
184+
sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb
185+
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
186+
sudo apt update -y && sudo apt install -y libphp8.5-embed
190187
191188
- name: Setup Rust
192189
uses: dtolnay/rust-toolchain@master
@@ -231,7 +228,7 @@ jobs:
231228
runs-on: ubuntu-latest
232229
strategy:
233230
matrix:
234-
php: ["8.1", "8.2", "8.3", "8.4"]
231+
php: ["8.1", "8.2", "8.3", "8.4", "8.5"]
235232
phpts: [["-zts", "TS"], ["", "NTS"]]
236233
env:
237234
CARGO_TERM_COLOR: always

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM rust:latest AS base
2-
ARG PHP_VERSION=8.4
2+
ARG PHP_VERSION=8.5
33
WORKDIR /tmp
44
RUN <<EOF
55
set -e

allowed_bindings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ bind! {
271271
zend_hash_get_current_key_zval_ex,
272272
zend_hash_get_current_data_ex,
273273
zend_hash_move_backwards_ex,
274+
zend_hash_key_type,
274275
zend_array_count,
275276
gc_possible_root,
276277
ZEND_ACC_NOT_SERIALIZABLE,

build.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ enum ApiVersion {
268268
Php82 = 2022_08_29,
269269
Php83 = 2023_08_31,
270270
Php84 = 2024_09_24,
271+
Php85 = 2025_09_25,
271272
}
272273

273274
impl ApiVersion {
@@ -285,7 +286,7 @@ impl ApiVersion {
285286

286287
/// Returns the maximum API version supported by ext-php-rs.
287288
pub const fn max() -> Self {
288-
ApiVersion::Php84
289+
ApiVersion::Php85
289290
}
290291

291292
pub fn versions() -> Vec<Self> {
@@ -295,6 +296,7 @@ impl ApiVersion {
295296
ApiVersion::Php82,
296297
ApiVersion::Php83,
297298
ApiVersion::Php84,
299+
ApiVersion::Php85,
298300
]
299301
}
300302

@@ -313,6 +315,7 @@ impl ApiVersion {
313315
ApiVersion::Php82 => "php82",
314316
ApiVersion::Php83 => "php83",
315317
ApiVersion::Php84 => "php84",
318+
ApiVersion::Php85 => "php85",
316319
}
317320
}
318321

@@ -323,6 +326,7 @@ impl ApiVersion {
323326
ApiVersion::Php82 => "EXT_PHP_RS_PHP_82",
324327
ApiVersion::Php83 => "EXT_PHP_RS_PHP_83",
325328
ApiVersion::Php84 => "EXT_PHP_RS_PHP_84",
329+
ApiVersion::Php85 => "EXT_PHP_RS_PHP_85",
326330
}
327331
}
328332
}
@@ -344,7 +348,10 @@ impl TryFrom<u32> for ApiVersion {
344348
x if ((ApiVersion::Php83 as u32)..(ApiVersion::Php84 as u32)).contains(&x) => {
345349
Ok(ApiVersion::Php83)
346350
}
347-
x if (ApiVersion::Php84 as u32) == x => Ok(ApiVersion::Php84),
351+
x if ((ApiVersion::Php84 as u32)..(ApiVersion::Php85 as u32)).contains(&x) => {
352+
Ok(ApiVersion::Php84)
353+
}
354+
x if (ApiVersion::Php85 as u32) == x => Ok(ApiVersion::Php85),
348355
version => Err(anyhow!(
349356
"The current version of PHP is not supported. Current PHP API version: {}, requires a version between {} and {}",
350357
version,
@@ -371,7 +378,7 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {
371378
// The PHP version cfg flags should also stack - if you compile on PHP 8.2 you
372379
// should get both the `php81` and `php82` flags.
373380
println!(
374-
"cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php84, php_zts, php_debug, docs)"
381+
"cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php84, php85, php_zts, php_debug, docs)"
375382
);
376383

377384
if version == ApiVersion::Php80 {
@@ -416,6 +423,7 @@ fn main() -> Result<()> {
416423
println!("cargo:rustc-cfg=php82");
417424
println!("cargo:rustc-cfg=php83");
418425
println!("cargo:rustc-cfg=php84");
426+
println!("cargo:rustc-cfg=php85");
419427
std::fs::copy("docsrs_bindings.rs", out_path)
420428
.expect("failed to copy docs.rs stub bindings to out directory");
421429
return Ok(());

0 commit comments

Comments
 (0)