Skip to content

Commit 1f0194c

Browse files
committed
Resolves compat
1 parent 2a0085b commit 1f0194c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

phper-sys/php_wrapper.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ phper_init_class_entry_handler(zend_class_entry *class_ce, void *argument);
5454
#define ZEND_CALL_MAY_HAVE_UNDEF (1 << 26)
5555
#endif
5656

57+
// ==================================================
58+
// BC for PHP 8.5:
59+
// ==================================================
60+
const int PHPER_HASH_KEY_IS_STRING = (int) HASH_KEY_IS_STRING;
61+
const int PHPER_HASH_KEY_IS_LONG = (int) HASH_KEY_IS_LONG;
62+
5763
// ==================================================
5864
// zval apis:
5965
// ==================================================

phper/src/arrays.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::{
2020
ops::Deref,
2121
ptr::null_mut,
2222
};
23+
use phper_sys::{PHPER_HASH_KEY_IS_STRING, PHPER_HASH_KEY_IS_LONG};
2324

2425
/// Key for [ZArr].
2526
#[derive(Debug, Clone, PartialEq, From)]
@@ -463,9 +464,9 @@ impl<'a> Iterator for RawIter<'a> {
463464
&mut self.pos,
464465
) as u32;
465466

466-
let iter_key = if result == HASH_KEY_IS_STRING {
467+
let iter_key = if result == PHPER_HASH_KEY_IS_STRING {
467468
IterKey::ZStr(ZStr::from_mut_ptr(str_index))
468-
} else if result == HASH_KEY_IS_LONG {
469+
} else if result == PHPER_HASH_KEY_IS_LONG {
469470
#[allow(clippy::unnecessary_cast)]
470471
IterKey::Index(num_index as u64)
471472
} else {

0 commit comments

Comments
 (0)