ext-php-rs
ext-php-rs copied to clipboard
Move zval value coercing into `FromZval`
At the moment, calling zval.string() will attempt to convert a f64 into a string, so zval.string() != zval.str() all the time. This should be removed, and a new function added to FromZval, coerce_from_zval():
pub trait FromZval<'a> {
fn from_zval(zval: &'a Zval) -> Option<Self>;
// by default, most types won't need coercing
fn coerce_from_zval(zval: &'a Zval) -> Option<Self> {
Self::from_zval(zval)
}
}