Skip to content

Commit 08be145

Browse files
authored
Merge branch 'master' into 453_ZendHashTable_numeric_keys
2 parents 560eb29 + 8dbed1b commit 08be145

File tree

9 files changed

+30
-11
lines changed

9 files changed

+30
-11
lines changed

crates/cli/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ enum Args {
9090
Stubs(Stubs),
9191
}
9292

93+
#[allow(clippy::struct_excessive_bools)]
9394
#[derive(Parser)]
9495
#[allow(clippy::struct_excessive_bools)]
9596
struct Install {
@@ -272,7 +273,7 @@ fn get_ext_dir() -> AResult<PathBuf> {
272273
bail!("Failed to call PHP: {:?}", cmd);
273274
}
274275
let stdout = String::from_utf8_lossy(&cmd.stdout);
275-
let ext_dir = PathBuf::from(&*stdout);
276+
let ext_dir = PathBuf::from(stdout.rsplit('\n').next().unwrap());
276277
if !ext_dir.is_dir() {
277278
if ext_dir.exists() {
278279
bail!(
@@ -302,7 +303,7 @@ fn get_php_ini() -> AResult<PathBuf> {
302303
bail!("Failed to call PHP: {:?}", cmd);
303304
}
304305
let stdout = String::from_utf8_lossy(&cmd.stdout);
305-
let ini = PathBuf::from(&*stdout);
306+
let ini = PathBuf::from(stdout.rsplit('\n').next().unwrap());
306307
if !ini.is_file() {
307308
bail!(
308309
"php.ini does not exist or is not a file at the given path: {:?}",

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
system = "x86_64-linux";
1818
overlays = [ (import rust-overlay) ];
1919
pkgs = import nixpkgs { inherit system overlays; };
20-
php-dev = pkgs.php.unwrapped.dev;
20+
php = pkgs.php.buildEnv { embedSupport = true; };
21+
php-dev = php.unwrapped.dev;
2122
in
2223
{
2324
devShells.${system} = {
@@ -32,7 +33,7 @@
3233
nativeBuildInputs = [ pkgs.rust-bin.stable.latest.default ];
3334

3435
shellHook = ''
35-
export LIBCLANG_PATH="''$LIBCLANG_PATH ${pkgs.libclang.lib}/lib"
36+
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib"
3637
'';
3738
};
3839
};

src/builders/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<'a> FunctionBuilder<'a> {
138138
pub fn returns(mut self, type_: DataType, as_ref: bool, allow_null: bool) -> Self {
139139
self.retval = Some(type_);
140140
self.ret_as_ref = as_ref;
141-
self.ret_as_null = allow_null;
141+
self.ret_as_null = allow_null && type_ != DataType::Void && type_ != DataType::Mixed;
142142
self
143143
}
144144

src/types/array.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ impl ZendHashTable {
253253
/// ht.insert("test", "hello world");
254254
/// assert_eq!(ht.get("test").and_then(|zv| zv.str()), Some("hello world"));
255255
/// ```
256+
// TODO: Verify if this is safe to use, as it allows mutating the
257+
// hashtable while only having a reference to it. #461
258+
#[allow(clippy::mut_from_ref)]
256259
#[must_use]
257260
#[allow(clippy::mut_from_ref)]
258261
pub fn get_mut<'a, K>(&self, key: K) -> Option<&mut Zval>
@@ -349,6 +352,9 @@ impl ZendHashTable {
349352
/// ht.push(100);
350353
/// assert_eq!(ht.get_index(0).and_then(|zv| zv.long()), Some(100));
351354
/// ```
355+
// TODO: Verify if this is safe to use, as it allows mutating the
356+
// hashtable while only having a reference to it. #461
357+
#[allow(clippy::mut_from_ref)]
352358
#[must_use]
353359
#[allow(clippy::mut_from_ref)]
354360
pub fn get_index_mut(&self, key: i64) -> Option<&mut Zval> {

src/types/class_object.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ impl<T: RegisteredClass> ZendClassObject<T> {
173173
Self::internal_from_zend_obj(std)
174174
}
175175

176+
// TODO: Verify if this is safe to use, as it allows mutating the
177+
// hashtable while only having a reference to it. #461
176178
#[allow(clippy::mut_from_ref)]
177179
fn internal_from_zend_obj(std: &zend_object) -> Option<&mut Self> {
178180
let std = ptr::from_ref(std).cast::<c_char>();

src/types/zval.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ impl Zval {
261261

262262
/// Returns a mutable reference to the zval if it is an internal indirect
263263
/// reference.
264+
// TODO: Verify if this is safe to use, as it allows mutating the
265+
// hashtable while only having a reference to it. #461
266+
#[allow(clippy::mut_from_ref)]
264267
#[must_use]
265268
#[allow(clippy::mut_from_ref)]
266269
pub fn indirect_mut(&self) -> Option<&mut Zval> {

src/zend/class.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ impl ClassEntry {
113113
/// Returns the iterator for the class for a specific instance
114114
///
115115
/// Returns [`None`] if there is no associated iterator for the class.
116+
// TODO: Verify if this is safe to use, as it allows mutating the
117+
// hashtable while only having a reference to it. #461
118+
#[allow(clippy::mut_from_ref)]
116119
#[must_use]
117120
#[allow(clippy::mut_from_ref)]
118121
pub fn get_iterator<'a>(&self, zval: &'a Zval, by_ref: bool) -> Option<&'a mut ZendIterator> {

src/zend/globals.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ impl ExecutorGlobals {
105105
}
106106

107107
/// Attempts to retrieve the global functions hash table as mutable.
108+
// TODO: Verify if this is safe to use, as it allows mutating the
109+
// hashtable while only having a reference to it. #461
110+
#[allow(clippy::mut_from_ref)]
108111
#[must_use]
109112
#[allow(clippy::mut_from_ref)]
110113
pub fn function_table_mut(&self) -> Option<&mut ZendHashTable> {

0 commit comments

Comments
 (0)