Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
1 change: 1 addition & 0 deletions phper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
] }
Expand Down
26 changes: 24 additions & 2 deletions phper/src/arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -463,16 +464,37 @@ 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 {
self.finished = true;
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;
Expand Down
2 changes: 1 addition & 1 deletion phper/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Constant {
module_number,
)
}
}
};
}
}
}
Loading