Skip to content

Commit 5e43894

Browse files
committed
Support php 8.4 internal api changes
1 parent 303db2b commit 5e43894

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

build.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {
230230

231231
const PHP_83_API_VER: u32 = 20230831;
232232

233-
println!("cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php_zts, php_debug, docs)");
233+
const PHP_84_API_VER: u32 = 20240924;
234+
235+
println!("cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php84, php_zts, php_debug, docs)");
234236
println!("cargo:rustc-cfg=php80");
235237

236238
if (PHP_81_API_VER..PHP_82_API_VER).contains(&version) {
@@ -245,6 +247,10 @@ fn check_php_version(info: &PHPInfo) -> Result<()> {
245247
println!("cargo:rustc-cfg=php83");
246248
}
247249

250+
if version >= PHP_84_API_VER {
251+
println!("cargo:rustc-cfg=php84");
252+
}
253+
248254
Ok(())
249255
}
250256

src/builders/function.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ impl<'a> FunctionBuilder<'a> {
5555
arg_info: ptr::null(),
5656
num_args: 0,
5757
flags: 0, // TBD?
58+
#[cfg(php84)]
59+
doc_comment: ptr::null(),
60+
#[cfg(php84)]
61+
frameless_function_infos: ptr::null(),
5862
},
5963
args: vec![],
6064
n_req: None,
@@ -79,6 +83,10 @@ impl<'a> FunctionBuilder<'a> {
7983
arg_info: ptr::null(),
8084
num_args: 0,
8185
flags: MethodFlags::Abstract.bits(),
86+
#[cfg(php84)]
87+
doc_comment: ptr::null(),
88+
#[cfg(php84)]
89+
frameless_function_infos: ptr::null(),
8290
},
8391
args: vec![],
8492
n_req: None,

src/zend/function.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ impl FunctionEntry {
3838
arg_info: ptr::null(),
3939
num_args: 0,
4040
flags: 0,
41+
#[cfg(php84)]
42+
doc_comment: ptr::null(),
43+
#[cfg(php84)]
44+
frameless_function_infos: ptr::null(),
4145
}
4246
}
4347

src/zend/handlers.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,18 @@ impl ZendObjectHandlers {
238238
let mut zv = Zval::new();
239239
val.get(self_, &mut zv)?;
240240

241-
#[allow(clippy::unnecessary_mut_passed)]
242-
if zend_is_true(&mut zv) == 1 {
243-
return Ok(1);
241+
cfg_if::cfg_if! {
242+
if #[cfg(php84)] {
243+
#[allow(clippy::unnecessary_mut_passed)]
244+
if zend_is_true(&mut zv) == true {
245+
return Ok(1);
246+
}
247+
} else {
248+
#[allow(clippy::unnecessary_mut_passed)]
249+
if zend_is_true(&mut zv) == 1 {
250+
return Ok(1);
251+
}
252+
}
244253
}
245254
}
246255
}

0 commit comments

Comments
 (0)