Skip to content

Commit 2ebc015

Browse files
authored
Merge pull request #280 from davidcole1340/fix_279
Fix aarch64 build (fixes #279)
2 parents 5fdd8fa + c87dc4b commit 2ebc015

File tree

7 files changed

+31
-23
lines changed

7 files changed

+31
-23
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs"
55
homepage = "https://github.com/davidcole1340/ext-php-rs"
66
license = "MIT OR Apache-2.0"
77
keywords = ["php", "ffi", "zend"]
8-
version = "0.10.3"
8+
version = "0.10.4"
99
authors = ["David Cole <[email protected]>"]
1010
edition = "2018"
1111
categories = ["api-bindings"]

src/embed/mod.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Provides implementations for running php code from rust.
22
//! It only works on linux for now and you should have `php-embed` installed
33
//!
4-
//! This crate was only test with PHP 8.2 please report any issue with other version
5-
//! You should only use this crate for test purpose, it's not production ready
4+
//! This crate was only test with PHP 8.2 please report any issue with other
5+
//! version You should only use this crate for test purpose, it's not production
6+
//! ready
67
78
mod ffi;
89

@@ -43,13 +44,14 @@ static RUN_FN_LOCK: RwLock<()> = const_rwlock(());
4344
impl Embed {
4445
/// Run a php script from a file
4546
///
46-
/// This function will only work correctly when used inside the `Embed::run` function
47-
/// otherwise behavior is unexpected
47+
/// This function will only work correctly when used inside the `Embed::run`
48+
/// function otherwise behavior is unexpected
4849
///
4950
/// # Returns
5051
///
5152
/// * `Ok(())` - The script was executed successfully
52-
/// * `Err(EmbedError)` - An error occured during the execution of the script
53+
/// * `Err(EmbedError)` - An error occured during the execution of the
54+
/// script
5355
///
5456
/// # Example
5557
///
@@ -97,10 +99,10 @@ impl Embed {
9799

98100
/// Start and run embed sapi engine
99101
///
100-
/// This function will allow to run php code from rust, the same PHP context is keep between calls
101-
/// inside the function passed to this method.
102-
/// Which means subsequent calls to `Embed::eval` or `Embed::run_script` will be able to access
103-
/// variables defined in previous calls
102+
/// This function will allow to run php code from rust, the same PHP context
103+
/// is keep between calls inside the function passed to this method.
104+
/// Which means subsequent calls to `Embed::eval` or `Embed::run_script`
105+
/// will be able to access variables defined in previous calls
104106
///
105107
/// # Returns
106108
///
@@ -127,7 +129,8 @@ impl Embed {
127129
// @TODO handle php thread safe
128130
//
129131
// This is to prevent multiple threads from running php at the same time
130-
// At some point we should detect if php is compiled with thread safety and avoid doing that in this case
132+
// At some point we should detect if php is compiled with thread safety and
133+
// avoid doing that in this case
131134
let _guard = RUN_FN_LOCK.write();
132135

133136
let panic = unsafe {
@@ -155,7 +158,8 @@ impl Embed {
155158

156159
/// Evaluate a php code
157160
///
158-
/// This function will only work correctly when used inside the `Embed::run` function
161+
/// This function will only work correctly when used inside the `Embed::run`
162+
/// function
159163
///
160164
/// # Returns
161165
///

src/types/class_object.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::{
55
fmt::Debug,
66
mem,
77
ops::{Deref, DerefMut},
8+
os::raw::c_char,
89
ptr::{self, NonNull},
910
};
1011

@@ -161,7 +162,7 @@ impl<T: RegisteredClass> ZendClassObject<T> {
161162
}
162163

163164
fn _from_zend_obj(std: &zend_object) -> Option<&mut Self> {
164-
let std = std as *const zend_object as *const i8;
165+
let std = std as *const zend_object as *const c_char;
165166
let ptr = unsafe {
166167
let ptr = std.offset(0 - Self::std_offset() as isize) as *const Self;
167168
(ptr as *mut Self).as_mut()?

src/types/object.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Represents an object in PHP. Allows for overriding the internal object used
22
//! by classes, allowing users to store Rust data inside a PHP object.
33
4-
use std::{convert::TryInto, fmt::Debug, ops::DerefMut};
4+
use std::{convert::TryInto, fmt::Debug, ops::DerefMut, os::raw::c_char};
55

66
use crate::{
77
boxed::{ZBox, ZBoxable},
@@ -146,7 +146,7 @@ impl ZendObject {
146146
unsafe {
147147
let res = zend_hash_str_find_ptr_lc(
148148
&(*self.ce).function_table,
149-
name.as_ptr() as *const i8,
149+
name.as_ptr() as *const c_char,
150150
name.len(),
151151
) as *mut zend_function;
152152
if res.is_null() {

src/zend/function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub type Function = zend_function;
5252
impl Function {
5353
pub fn try_from_function(name: &str) -> Option<Self> {
5454
unsafe {
55-
let res = zend_fetch_function_str(name.as_ptr() as *const i8, name.len());
55+
let res = zend_fetch_function_str(name.as_ptr() as *const c_char, name.len());
5656
if res.is_null() {
5757
return None;
5858
}
@@ -65,7 +65,7 @@ impl Function {
6565
Some(ce) => unsafe {
6666
let res = zend_hash_str_find_ptr_lc(
6767
&ce.function_table,
68-
name.as_ptr() as *const i8,
68+
name.as_ptr() as *const c_char,
6969
name.len(),
7070
) as *mut zend_function;
7171
if res.is_null() {

src/zend/ini_entry_def.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ use crate::{ffi::zend_ini_entry_def, ffi::zend_register_ini_entries, flags::IniE
77

88
/// A Zend ini entry definition.
99
///
10-
/// To register ini definitions for extensions, the IniEntryDef builder should be used. Ini
11-
/// entries should be registered in your module's startup_function via `IniEntryDef::register(Vec<IniEntryDef>)`.
10+
/// To register ini definitions for extensions, the IniEntryDef builder should
11+
/// be used. Ini entries should be registered in your module's startup_function
12+
/// via `IniEntryDef::register(Vec<IniEntryDef>)`.
1213
pub type IniEntryDef = zend_ini_entry_def;
1314

1415
impl IniEntryDef {

src/zend/try_catch.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ pub(crate) unsafe extern "C" fn panic_wrapper<R, F: FnMut() -> R + RefUnwindSafe
1818

1919
/// PHP propose a try catch mechanism in C using setjmp and longjmp (bailout)
2020
/// It store the arg of setjmp into the bailout field of the global executor
21-
/// If a bailout is triggered, the executor will jump to the setjmp and restore the previous setjmp
21+
/// If a bailout is triggered, the executor will jump to the setjmp and restore
22+
/// the previous setjmp
2223
///
2324
/// try_catch allow to use this mechanism
2425
///
@@ -60,10 +61,11 @@ pub fn try_catch<R, F: FnMut() -> R + RefUnwindSafe>(func: F) -> Result<R, Catch
6061
/// # Safety
6162
///
6263
/// This function is unsafe because it can cause memory leaks
63-
/// Since it will jump to the last try catch block, it will not call the destructor of the current scope
64-
///
65-
/// When using this function you should ensure that all the memory allocated in the current scope is released
64+
/// Since it will jump to the last try catch block, it will not call the
65+
/// destructor of the current scope
6666
///
67+
/// When using this function you should ensure that all the memory allocated in
68+
/// the current scope is released
6769
pub unsafe fn bailout() -> ! {
6870
ext_php_rs_zend_bailout();
6971
}

0 commit comments

Comments
 (0)