diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 130dca1d..a3c6c085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,7 @@ jobs: - "8.1" - "8.2" - "8.3" + - "8.4" runs-on: ${{ matrix.os }} steps: diff --git a/README.md b/README.md index 4e90b84b..6469444e 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh ### Necessary -- **rust** 1.65 or later +- **rust** 1.79 or later - **libclang** 9.0 or later - **php** 7.0 or later diff --git a/phper-sys/build.rs b/phper-sys/build.rs index 597549c2..1cef6eb1 100644 --- a/phper-sys/build.rs +++ b/phper-sys/build.rs @@ -44,6 +44,10 @@ fn main() { .allowlist_file("php_wrapper\\.c") // Block the `zend_ini_parse_quantity` because it's document causes the doc test to fail. .blocklist_function("zend_ini_parse_quantity") + // Block the `zend_startup` because it fails checks. + .blocklist_function("zend_startup") + // Block the `zend_random_bytes_insecure` because it fails checks. + .blocklist_item("zend_random_bytes_insecure") .clang_args(&includes) .derive_default(true); diff --git a/phper/Cargo.toml b/phper/Cargo.toml index 0c5df9d4..241bded4 100644 --- a/phper/Cargo.toml +++ b/phper/Cargo.toml @@ -22,6 +22,7 @@ repository = { workspace = true } license = { workspace = true } [dependencies] +cfg-if = "1.0.0" derive_more = "0.99.18" indexmap = "2.3.0" once_cell = "1.19.0" diff --git a/phper/src/classes.rs b/phper/src/classes.rs index 4661efbd..68166dd0 100644 --- a/phper/src/classes.rs +++ b/phper/src/classes.rs @@ -890,7 +890,25 @@ unsafe extern "C" fn create_object(ce: *mut zend_class_entry) -> *mut zend_objec let object = state_object.as_mut_object().as_mut_ptr(); zend_object_std_init(object, ce); object_properties_init(object, ce); - rebuild_object_properties(object); + + cfg_if::cfg_if! { + if #[cfg(any( + phper_major_version = "7", + all( + phper_major_version = "8", + any( + phper_minor_version = "0", + phper_minor_version = "1", + phper_minor_version = "2", + phper_minor_version = "3", + ), + ) + ))] { + rebuild_object_properties(object); + } else { + rebuild_object_properties_internal(object); + } + } // Set handlers let mut handlers = Box::new(std_object_handlers); diff --git a/phper/src/errors.rs b/phper/src/errors.rs index aa50f831..bd8a1472 100644 --- a/phper/src/errors.rs +++ b/phper/src/errors.rs @@ -482,6 +482,7 @@ thread_local! { impl Default for ExceptionGuard { fn default() -> Self { EXCEPTION_STACK.with(|stack| unsafe { + #[allow(static_mut_refs)] stack .borrow_mut() .push(replace(&mut eg!(exception), null_mut())); diff --git a/phper/src/functions.rs b/phper/src/functions.rs index 9cfdfaf8..71dfc302 100644 --- a/phper/src/functions.rs +++ b/phper/src/functions.rs @@ -178,12 +178,14 @@ impl FunctionEntry { let flags = visibility.unwrap_or(Visibility::default() as u32); + #[allow(clippy::needless_update)] zend_function_entry { fname: name.as_ptr().cast(), handler: raw_handler, arg_info: Box::into_raw(infos.into_boxed_slice()).cast(), num_args: arguments.len() as u32, flags, + ..Default::default() } } @@ -657,6 +659,7 @@ pub(crate) fn call_raw_common(call_fn: impl FnOnce(&mut ZVal)) -> crate::Result< unsafe { if !eg!(exception).is_null() { + #[allow(static_mut_refs)] let e = ptr::replace(&mut eg!(exception), null_mut()); let obj = ZObject::from_raw(e); match ThrowObject::new(obj) {