Skip to content

Commit e5418bb

Browse files
nickschuchjmjoy
andauthored
Adds PHP 8.4 (#163)
Co-authored-by: jmjoy <jmjoy@apache.org>
1 parent fe07b2e commit e5418bb

File tree

7 files changed

+30
-2
lines changed

7 files changed

+30
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
- "8.1"
5454
- "8.2"
5555
- "8.3"
56+
- "8.4"
5657

5758
runs-on: ${{ matrix.os }}
5859
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh
1818

1919
### Necessary
2020

21-
- **rust** 1.65 or later
21+
- **rust** 1.79 or later
2222
- **libclang** 9.0 or later
2323
- **php** 7.0 or later
2424

phper-sys/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ fn main() {
4444
.allowlist_file("php_wrapper\\.c")
4545
// Block the `zend_ini_parse_quantity` because it's document causes the doc test to fail.
4646
.blocklist_function("zend_ini_parse_quantity")
47+
// Block the `zend_startup` because it fails checks.
48+
.blocklist_function("zend_startup")
49+
// Block the `zend_random_bytes_insecure` because it fails checks.
50+
.blocklist_item("zend_random_bytes_insecure")
4751
.clang_args(&includes)
4852
.derive_default(true);
4953

phper/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ repository = { workspace = true }
2222
license = { workspace = true }
2323

2424
[dependencies]
25+
cfg-if = "1.0.0"
2526
derive_more = "0.99.18"
2627
indexmap = "2.3.0"
2728
once_cell = "1.19.0"

phper/src/classes.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,25 @@ unsafe extern "C" fn create_object(ce: *mut zend_class_entry) -> *mut zend_objec
890890
let object = state_object.as_mut_object().as_mut_ptr();
891891
zend_object_std_init(object, ce);
892892
object_properties_init(object, ce);
893-
rebuild_object_properties(object);
893+
894+
cfg_if::cfg_if! {
895+
if #[cfg(any(
896+
phper_major_version = "7",
897+
all(
898+
phper_major_version = "8",
899+
any(
900+
phper_minor_version = "0",
901+
phper_minor_version = "1",
902+
phper_minor_version = "2",
903+
phper_minor_version = "3",
904+
),
905+
)
906+
))] {
907+
rebuild_object_properties(object);
908+
} else {
909+
rebuild_object_properties_internal(object);
910+
}
911+
}
894912

895913
// Set handlers
896914
let mut handlers = Box::new(std_object_handlers);

phper/src/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ thread_local! {
482482
impl Default for ExceptionGuard {
483483
fn default() -> Self {
484484
EXCEPTION_STACK.with(|stack| unsafe {
485+
#[allow(static_mut_refs)]
485486
stack
486487
.borrow_mut()
487488
.push(replace(&mut eg!(exception), null_mut()));

phper/src/functions.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,14 @@ impl FunctionEntry {
178178

179179
let flags = visibility.unwrap_or(Visibility::default() as u32);
180180

181+
#[allow(clippy::needless_update)]
181182
zend_function_entry {
182183
fname: name.as_ptr().cast(),
183184
handler: raw_handler,
184185
arg_info: Box::into_raw(infos.into_boxed_slice()).cast(),
185186
num_args: arguments.len() as u32,
186187
flags,
188+
..Default::default()
187189
}
188190
}
189191

@@ -657,6 +659,7 @@ pub(crate) fn call_raw_common(call_fn: impl FnOnce(&mut ZVal)) -> crate::Result<
657659

658660
unsafe {
659661
if !eg!(exception).is_null() {
662+
#[allow(static_mut_refs)]
660663
let e = ptr::replace(&mut eg!(exception), null_mut());
661664
let obj = ZObject::from_raw(e);
662665
match ThrowObject::new(obj) {

0 commit comments

Comments
 (0)