From 9b56722351014f3029c26a47f326b2b8f29073a0 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 28 Nov 2023 19:38:14 +0100 Subject: [PATCH] Remove double type coercion --- Cargo.toml | 2 +- src/types/zval.rs | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9b4246ab5..ac1d5bdd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ repository = "https://github.com/davidcole1340/ext-php-rs" homepage = "https://github.com/davidcole1340/ext-php-rs" license = "MIT OR Apache-2.0" keywords = ["php", "ffi", "zend"] -version = "0.11.2" +version = "0.12.0" authors = ["David Cole "] edition = "2018" categories = ["api-bindings"] diff --git a/src/types/zval.rs b/src/types/zval.rs index d997d53d1..628179cf7 100644 --- a/src/types/zval.rs +++ b/src/types/zval.rs @@ -95,7 +95,7 @@ impl Zval { if self.is_double() { Some(unsafe { self.value.dval }) } else { - self.long().map(|x| x as f64) + None } } @@ -114,17 +114,10 @@ impl Zval { /// Returns the value of the zval if it is a string. /// - /// If the zval does not contain a string, the function will check if it - /// contains a double or a long, and if so it will convert the value to - /// a [`String`] and return it. Don't rely on this logic, as there is - /// potential for this to change to match the output of the [`str()`] - /// function. - /// /// [`str()`]: #method.str pub fn string(&self) -> Option { self.str() .map(|s| s.to_string()) - .or_else(|| self.double().map(|x| x.to_string())) } /// Returns the value of the zval if it is a string.