-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add is_identical for zvals #217
Add is_identical for zvals #217
Conversation
docsrs_bindings.rs
Outdated
@@ -79,8 +80,8 @@ pub const ZEND_ACC_STRICT_TYPES: u32 = 2147483648; | |||
pub const ZEND_ISEMPTY: u32 = 1; | |||
pub const _ZEND_SEND_MODE_SHIFT: u32 = 25; | |||
pub const _ZEND_IS_VARIADIC_BIT: u32 = 134217728; | |||
pub const ZEND_MODULE_API_NO: u32 = 20220829; | |||
pub const USING_ZTS: u32 = 0; | |||
pub const ZEND_MODULE_API_NO: u32 = 20210902; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use PHP8.2 to generate doc binding
docsrs_bindings.rs
Outdated
@@ -1,6 +1,6 @@ | |||
/* automatically generated by rust-bindgen 0.63.0 */ | |||
|
|||
pub const ZEND_DEBUG: u32 = 1; | |||
pub const ZEND_DEBUG: u32 = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a PHP version with debug mode
/// Checks if the zval is identical to another one. | ||
/// This works like `===` in php. | ||
/// | ||
/// # Parameters | ||
/// | ||
/// * `other` - The the zval to check identity against. | ||
pub fn is_identical(&self, other: &Self) -> bool { | ||
let self_p: *const Self = self; | ||
let other_p: *const Self = other; | ||
unsafe { zend_is_identical(self_p as *mut Self, other_p as *mut Self) } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition is good! 👍🏻
3a14026
to
33148cd
Compare
extern "C" { | ||
pub fn zend_is_identical(op1: *mut zval, op2: *mut zval) -> bool; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff looks way better now 😅
33148cd
to
2ce19af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thank you
I was missing the ability to compare two zvals with PHP's
===
operator.To allow for it, I exposed the
zend_is_identical
function that the Zend engine maps to the===
token.