From 2a0085be24d9f4058f3a107dfb2599781d824f21 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Mon, 1 Dec 2025 19:26:06 +1000 Subject: [PATCH 1/3] Adds 8.5 --- .github/workflows/ci.yml | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb3a1eb..a50d8fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,7 @@ jobs: - "8.2" - "8.3" - "8.4" + - "8.5" runs-on: ${{ matrix.os }} steps: diff --git a/README.md b/README.md index 3d84980..784a8ac 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh | | macOS | ✅ | | | Windows | ❌ | | **PHP Version** | 7.0 ~ 7.4 | ✅ | -| | 8.0 ~ 8.4 | ✅ | +| | 8.0 ~ 8.5 | ✅ | | **PHP Mode** | NTS | ✅ | | | ZTS | ❌ | | **SAPI** | CLI | ✅ | From daa9a7d1ee4922a35170e6d8f3df87baff94c519 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Wed, 3 Dec 2025 17:41:08 +1000 Subject: [PATCH 2/3] Backwards compat for PHPER_HASH_KEY_IS_STRING and PHPER_HASH_KEY_IS_LONG --- phper-sys/php_wrapper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phper-sys/php_wrapper.c b/phper-sys/php_wrapper.c index 72a0489..908ef1c 100644 --- a/phper-sys/php_wrapper.c +++ b/phper-sys/php_wrapper.c @@ -54,6 +54,9 @@ phper_init_class_entry_handler(zend_class_entry *class_ce, void *argument); #define ZEND_CALL_MAY_HAVE_UNDEF (1 << 26) #endif +const int PHPER_HASH_KEY_IS_STRING = (int) HASH_KEY_IS_STRING; +const int PHPER_HASH_KEY_IS_LONG = (int) HASH_KEY_IS_LONG; + // ================================================== // zval apis: // ================================================== From 0689edbb59ec09adda90403c173c373949066ec5 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Wed, 3 Dec 2025 16:58:36 +0800 Subject: [PATCH 3/3] fix: Remove deprecated hash key constants and update array iteration logic for PHPER 8.5 compatibility --- phper-sys/php_wrapper.c | 3 --- phper/Cargo.toml | 1 + phper/src/arrays.rs | 26 ++++++++++++++++++++++++-- phper/src/constants.rs | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/phper-sys/php_wrapper.c b/phper-sys/php_wrapper.c index 908ef1c..72a0489 100644 --- a/phper-sys/php_wrapper.c +++ b/phper-sys/php_wrapper.c @@ -54,9 +54,6 @@ phper_init_class_entry_handler(zend_class_entry *class_ce, void *argument); #define ZEND_CALL_MAY_HAVE_UNDEF (1 << 26) #endif -const int PHPER_HASH_KEY_IS_STRING = (int) HASH_KEY_IS_STRING; -const int PHPER_HASH_KEY_IS_LONG = (int) HASH_KEY_IS_LONG; - // ================================================== // zval apis: // ================================================== diff --git a/phper/Cargo.toml b/phper/Cargo.toml index 5791c67..600e246 100644 --- a/phper/Cargo.toml +++ b/phper/Cargo.toml @@ -44,6 +44,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [ 'cfg(phper_minor_version, values("2"))', 'cfg(phper_minor_version, values("3"))', 'cfg(phper_minor_version, values("4"))', + 'cfg(phper_minor_version, values("5"))', 'cfg(phper_zts)', 'cfg(phper_enum_supported)', ] } diff --git a/phper/src/arrays.rs b/phper/src/arrays.rs index b017e61..cb7cdbb 100644 --- a/phper/src/arrays.rs +++ b/phper/src/arrays.rs @@ -11,6 +11,7 @@ //! Apis relate to [zend_array]. use crate::{alloc::EBox, strings::ZStr, sys::*, values::ZVal}; +use cfg_if::cfg_if; use derive_more::From; use phper_alloc::ToRefOwned; use std::{ @@ -463,9 +464,29 @@ impl<'a> Iterator for RawIter<'a> { &mut self.pos, ) as u32; - let iter_key = if result == HASH_KEY_IS_STRING { + const IS_STRING: u32 = { + cfg_if! { + if #[cfg(all(phper_major_version = "8", phper_minor_version = "5"))] { + zend_hash_key_type_HASH_KEY_IS_STRING + } else { + HASH_KEY_IS_STRING + } + } + }; + + const IS_LONG: u32 = { + cfg_if! { + if #[cfg(all(phper_major_version = "8", phper_minor_version = "5"))] { + zend_hash_key_type_HASH_KEY_IS_LONG + } else { + HASH_KEY_IS_LONG + } + } + }; + + let iter_key = if result == IS_STRING { IterKey::ZStr(ZStr::from_mut_ptr(str_index)) - } else if result == HASH_KEY_IS_LONG { + } else if result == IS_LONG { #[allow(clippy::unnecessary_cast)] IterKey::Index(num_index as u64) } else { @@ -473,6 +494,7 @@ impl<'a> Iterator for RawIter<'a> { return None; }; + #[allow(clippy::unnecessary_mut_passed)] let val = zend_hash_get_current_data_ex(self.arr, &mut self.pos); if val.is_null() { self.finished = true; diff --git a/phper/src/constants.rs b/phper/src/constants.rs index 0ca762e..50970cc 100644 --- a/phper/src/constants.rs +++ b/phper/src/constants.rs @@ -75,7 +75,7 @@ impl Constant { module_number, ) } - } + }; } } }