Skip to content
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

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

Christian-Rades
Copy link
Contributor

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.

@@ -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;
Copy link
Collaborator

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

@@ -1,6 +1,6 @@
/* automatically generated by rust-bindgen 0.63.0 */

pub const ZEND_DEBUG: u32 = 1;
pub const ZEND_DEBUG: u32 = 0;
Copy link
Collaborator

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

Comment on lines +330 to +341
/// 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) }
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition is good! 👍🏻

Comment on lines +837 to +839
extern "C" {
pub fn zend_is_identical(op1: *mut zval, op2: *mut zval) -> bool;
}
Copy link
Contributor Author

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 😅

Copy link
Collaborator

@ptondereau ptondereau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you

@ptondereau ptondereau merged commit 87ac43d into davidcole1340:master Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants