Skip to content

Commit 0974858

Browse files
committed
Merge remote-tracking branch 'origin/master' into revert-293-revert-121-feat-integration-tests
2 parents c3900aa + 4fad486 commit 0974858

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
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.11.0"
8+
version = "0.12.0"
99
authors = ["David Cole <[email protected]>"]
1010
edition = "2018"
1111
categories = ["api-bindings"]

src/types/array.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,17 @@ impl ZendHashTable {
519519
/// # Example
520520
///
521521
/// ```no_run
522-
/// use ext_php_rs::types::ZendHashTable;
522+
/// use ext_php_rs::types::{ZendHashTable, ArrayKey};
523523
///
524524
/// let mut ht = ZendHashTable::new();
525525
///
526526
/// for (key, val) in ht.iter() {
527-
/// // ^ Index if inserted at an index.
528-
/// // ^ Optional string key, if inserted like a hashtable.
529-
/// // ^ Inserted value.
530-
///
527+
/// match &key {
528+
/// ArrayKey::Long(index) => {
529+
/// }
530+
/// ArrayKey::String(key) => {
531+
/// }
532+
/// }
531533
/// dbg!(key, val);
532534
/// }
533535
#[inline]

src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod object;
1313
mod string;
1414
mod zval;
1515

16-
pub use array::ZendHashTable;
16+
pub use array::{ArrayKey, ZendHashTable};
1717
pub use callable::ZendCallable;
1818
pub use class_object::ZendClassObject;
1919
pub use iterable::Iterable;

src/types/zval.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Zval {
9595
if self.is_double() {
9696
Some(unsafe { self.value.dval })
9797
} else {
98-
self.long().map(|x| x as f64)
98+
None
9999
}
100100
}
101101

@@ -114,17 +114,9 @@ impl Zval {
114114

115115
/// Returns the value of the zval if it is a string.
116116
///
117-
/// If the zval does not contain a string, the function will check if it
118-
/// contains a double or a long, and if so it will convert the value to
119-
/// a [`String`] and return it. Don't rely on this logic, as there is
120-
/// potential for this to change to match the output of the [`str()`]
121-
/// function.
122-
///
123117
/// [`str()`]: #method.str
124118
pub fn string(&self) -> Option<String> {
125-
self.str()
126-
.map(|s| s.to_string())
127-
.or_else(|| self.double().map(|x| x.to_string()))
119+
self.str().map(|s| s.to_string())
128120
}
129121

130122
/// Returns the value of the zval if it is a string.

0 commit comments

Comments
 (0)