[RFC] Strict operators directive#4375
Closed
jasny wants to merge 14 commits into
Closed
Conversation
Strict operators have affect on arithmetic operators. Split mul, pow, and div functions into slow and fast function (similar to add and sub). Split mod function to part that does casting and part that expects longs.
`compare_function` calls either `standard_compare_function` or `strict_compare_function` Changed is equal / is not equal to call strict_is_equal_function Don't do smart string comparison in strict mode Updated zend_vm to use `is_equal_function` for IS_EQUAL and IS_NOT_EQUAL
Fixed side effects with comparison operators.
Including array equality.
Always use ZEND_CASE for case (checking OP1_TYPE to free). Don't use specific resource id in concatenation test.
Includes support for Spl objects like ArrayObject and SplObjectStorage.
…operators mode. (suggested by @nikic)
Can't be sure of the exact operator in some cases (like unary plus that uses ZEND_MUL).
jasny
marked this pull request as ready for review
July 9, 2019 01:57
nikic
reviewed
Jul 9, 2019
| @@ -583,6 +586,10 @@ struct _zend_execute_data { | |||
| #define ZEND_RET_USES_STRICT_TYPES() \ | |||
| ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)) | |||
|
|
|||
| #define ZEND_USES_STRICT_OPERATORS() \ | |||
| ((EG(current_execute_data) && (EG(current_execute_data)->func->common.fn_flags & ZEND_ACC_STRICT_OPERATORS) != 0) || \ | |||
| (!EG(current_execute_data) && CG(active_op_array) && (CG(active_op_array)->fn_flags & ZEND_ACC_STRICT_OPERATORS) != 0)) | |||
Member
There was a problem hiding this comment.
It's unfortunate that the common run-time case and the rare compile-time cases are combined here.
carusogabriel
suggested changes
Jul 9, 2019
Contributor
|
Closing as the linked RFC has been withdrawn and replaced by https://wiki.php.net/rfc/string_to_number_comparison with PR #3886. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wiki.php.net/rfc/strict_operators