diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4745be522..7237b791b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - php: ["8.0", "8.1", "8.2", "8.3"] + php: ["8.0", "8.1", "8.2", "8.3", "8.4"] rust: [stable, nightly] clang: ["15", "17"] phpts: [ts, nts] diff --git a/build.rs b/build.rs index bcaabb416..523256497 100644 --- a/build.rs +++ b/build.rs @@ -16,7 +16,7 @@ use bindgen::RustTarget; use impl_::Provider; const MIN_PHP_API_VER: u32 = 20200930; -const MAX_PHP_API_VER: u32 = 20230831; +const MAX_PHP_API_VER: u32 = 20240924; pub trait PHPProvider<'a>: Sized { /// Create a new PHP provider. @@ -230,7 +230,11 @@ fn check_php_version(info: &PHPInfo) -> Result<()> { const PHP_83_API_VER: u32 = 20230831; - println!("cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php_zts, php_debug, docs)"); + const PHP_84_API_VER: u32 = 20240924; + + println!( + "cargo::rustc-check-cfg=cfg(php80, php81, php82, php83, php84, php_zts, php_debug, docs)" + ); println!("cargo:rustc-cfg=php80"); if (PHP_81_API_VER..PHP_82_API_VER).contains(&version) { @@ -245,6 +249,10 @@ fn check_php_version(info: &PHPInfo) -> Result<()> { println!("cargo:rustc-cfg=php83"); } + if version >= PHP_84_API_VER { + println!("cargo:rustc-cfg=php84"); + } + Ok(()) } diff --git a/src/builders/function.rs b/src/builders/function.rs index 60eddcc96..99f74f7e2 100644 --- a/src/builders/function.rs +++ b/src/builders/function.rs @@ -55,6 +55,10 @@ impl<'a> FunctionBuilder<'a> { arg_info: ptr::null(), num_args: 0, flags: 0, // TBD? + #[cfg(php84)] + doc_comment: ptr::null(), + #[cfg(php84)] + frameless_function_infos: ptr::null(), }, args: vec![], n_req: None, @@ -79,6 +83,10 @@ impl<'a> FunctionBuilder<'a> { arg_info: ptr::null(), num_args: 0, flags: MethodFlags::Abstract.bits(), + #[cfg(php84)] + doc_comment: ptr::null(), + #[cfg(php84)] + frameless_function_infos: ptr::null(), }, args: vec![], n_req: None, diff --git a/src/zend/function.rs b/src/zend/function.rs index 6e6dd1a39..a16ea1e61 100644 --- a/src/zend/function.rs +++ b/src/zend/function.rs @@ -38,6 +38,10 @@ impl FunctionEntry { arg_info: ptr::null(), num_args: 0, flags: 0, + #[cfg(php84)] + doc_comment: ptr::null(), + #[cfg(php84)] + frameless_function_infos: ptr::null(), } } diff --git a/src/zend/handlers.rs b/src/zend/handlers.rs index 7e88a7e05..5c0da7394 100644 --- a/src/zend/handlers.rs +++ b/src/zend/handlers.rs @@ -238,9 +238,18 @@ impl ZendObjectHandlers { let mut zv = Zval::new(); val.get(self_, &mut zv)?; - #[allow(clippy::unnecessary_mut_passed)] - if zend_is_true(&mut zv) == 1 { - return Ok(1); + cfg_if::cfg_if! { + if #[cfg(php84)] { + #[allow(clippy::unnecessary_mut_passed)] + if zend_is_true(&mut zv) == true { + return Ok(1); + } + } else { + #[allow(clippy::unnecessary_mut_passed)] + if zend_is_true(&mut zv) == 1 { + return Ok(1); + } + } } } } diff --git a/windows_build.rs b/windows_build.rs index bc0e75d89..39dd4ac89 100644 --- a/windows_build.rs +++ b/windows_build.rs @@ -163,12 +163,27 @@ impl DevelPack { /// Downloads a new PHP development pack, unzips it in the build script /// temporary directory. fn new(version: &str, is_zts: bool, arch: Arch) -> Result { + // If the PHP version is more than 8.4.1, use VS17 instead of VS16. + let version_float = version + .split('.') + .take(2) + .collect::>() + .join(".") + .parse::() + .context("Failed to parse PHP version as float")?; + + // PHP builds switched to VS17 in PHP 8.4.1. + let visual_studio_version = if version_float >= 8.4f32 { + "vs17" + } else { + "vs16" + }; + let zip_name = format!( "php-devel-pack-{}{}-Win32-{}-{}.zip", version, if is_zts { "" } else { "-nts" }, - "vs16", /* TODO(david): At the moment all PHPs supported by ext-php-rs use VS16 so - * this is constant. */ + visual_studio_version, arch ); @@ -207,8 +222,10 @@ impl DevelPack { Ok(devpack_path) } + let is_archive = if version == "8.4.1" { false } else { true }; + download(&zip_name, false) - .or_else(|_| download(&zip_name, true)) + .or_else(|_| download(&zip_name, is_archive)) .map(DevelPack) }