Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ enum Args {
Stubs(Stubs),
}

#[allow(clippy::struct_excessive_bools)]
#[derive(Parser)]
struct Install {
/// Changes the path that the extension is copied to. This will not
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
system = "x86_64-linux";
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
php-dev = pkgs.php.unwrapped.dev;
php = pkgs.php.buildEnv { embedSupport = true; };
php-dev = php.unwrapped.dev;
in
{
devShells.${system} = {
Expand All @@ -32,7 +33,7 @@
nativeBuildInputs = [ pkgs.rust-bin.stable.latest.default ];

shellHook = ''
export LIBCLANG_PATH="''$LIBCLANG_PATH ${pkgs.libclang.lib}/lib"
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib"
'';
};
};
Expand Down
6 changes: 3 additions & 3 deletions src/embed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ impl Embed {
};

unsafe {
zend_stream_init_filename(&mut file_handle, path.as_ptr());
zend_stream_init_filename(&raw mut file_handle, path.as_ptr());
}

let exec_result = try_catch(|| unsafe { php_execute_script(&mut file_handle) });
let exec_result = try_catch(|| unsafe { php_execute_script(&raw mut file_handle) });

match exec_result {
Err(_) => Err(EmbedError::CatchError),
Expand Down Expand Up @@ -208,7 +208,7 @@ impl Embed {
let exec_result = try_catch(|| unsafe {
zend_eval_string(
cstr.as_ptr().cast::<c_char>(),
&mut result,
&raw mut result,
c"run".as_ptr().cast(),
)
});
Expand Down
6 changes: 6 additions & 0 deletions src/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ impl ZendHashTable {
/// ht.insert("test", "hello world");
/// assert_eq!(ht.get("test").and_then(|zv| zv.str()), Some("hello world"));
/// ```
// TODO: Verify if this is safe to use, as it allows mutating the
// hashtable while only having a reference to it. #461
#[allow(clippy::mut_from_ref)]
#[must_use]
pub fn get_mut(&self, key: &'_ str) -> Option<&mut Zval> {
let str = CString::new(key).ok()?;
Expand Down Expand Up @@ -270,6 +273,9 @@ impl ZendHashTable {
/// ht.push(100);
/// assert_eq!(ht.get_index(0).and_then(|zv| zv.long()), Some(100));
/// ```
// TODO: Verify if this is safe to use, as it allows mutating the
// hashtable while only having a reference to it. #461
#[allow(clippy::mut_from_ref)]
#[must_use]
pub fn get_index_mut(&self, key: u64) -> Option<&mut Zval> {
unsafe { zend_hash_index_find(self, key).as_mut() }
Expand Down
3 changes: 3 additions & 0 deletions src/types/class_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ impl<T: RegisteredClass> ZendClassObject<T> {
Self::internal_from_zend_obj(std)
}

// TODO: Verify if this is safe to use, as it allows mutating the
// hashtable while only having a reference to it. #461
#[allow(clippy::mut_from_ref)]
fn internal_from_zend_obj(std: &zend_object) -> Option<&mut Self> {
let std = ptr::from_ref(std).cast::<c_char>();
let ptr = unsafe {
Expand Down
3 changes: 3 additions & 0 deletions src/types/zval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ impl Zval {

/// Returns a mutable reference to the zval if it is an internal indirect
/// reference.
// TODO: Verify if this is safe to use, as it allows mutating the
// hashtable while only having a reference to it. #461
#[allow(clippy::mut_from_ref)]
#[must_use]
pub fn indirect_mut(&self) -> Option<&mut Zval> {
if self.is_indirect() {
Expand Down
3 changes: 3 additions & 0 deletions src/zend/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ impl ClassEntry {
/// Returns the iterator for the class for a specific instance
///
/// Returns [`None`] if there is no associated iterator for the class.
// TODO: Verify if this is safe to use, as it allows mutating the
// hashtable while only having a reference to it. #461
#[allow(clippy::mut_from_ref)]
#[must_use]
pub fn get_iterator<'a>(&self, zval: &'a Zval, by_ref: bool) -> Option<&'a mut ZendIterator> {
let ptr: *const Self = self;
Expand Down
3 changes: 3 additions & 0 deletions src/zend/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ impl ExecutorGlobals {
}

/// Attempts to retrieve the global functions hash table as mutable.
// TODO: Verify if this is safe to use, as it allows mutating the
// hashtable while only having a reference to it. #461
#[allow(clippy::mut_from_ref)]
#[must_use]
pub fn function_table_mut(&self) -> Option<&mut ZendHashTable> {
unsafe { self.function_table.as_mut() }
Expand Down
2 changes: 1 addition & 1 deletion src/zend/try_catch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ mod tests {

let _ = try_catch(|| {
let mut result = "foo".to_string();
ptr = &mut result;
ptr = &raw mut result;

unsafe {
bailout();
Expand Down
Loading