-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ZPP changes evaluation tool #1110
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
Conversation
#if STH_DISABLE_NULL_TO_STRING | ||
} else { | ||
return 0; | ||
#endif |
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 need an else here to prevent a segfault (null pointer). I added a goto to the conversion logic in an else branch and it worked fine:
@@ -1241,6 +1241,9 @@ static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest,
#if STH_DISABLE_NULL_TO_STRING
} else {
return 0;
+#else
+ } else {
+ goto convert;
#endif
}
#if STH_DISABLE_BOOL_TO_STRING
@@ -1248,6 +1251,7 @@ static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest,
return 0;
#endif
} else {
+convert:
if (Z_COPYABLE_P(arg) && Z_REFCOUNT_P(arg) > 1) {
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.
It seems I fixed it almost the same way before I saw your comment. Fixed another small bug. Hope it's cleaner now. Thanks.
return 0; | ||
#endif | ||
#if STH_DISABLE_STRING_TO_BOOL | ||
} else if (Z_TYPE_P(arg) == IS_DOUBLE) { |
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.
typo. should be IS_STRING
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.
Fixed. Thanks
Closing as the corresponding RFC was rejected. |
This PR allows to test several potential changes in the ZPP ruleset, which is used when parsing internal function input arguments and will be potentially used for scalar type hinting.
Potential changes can be activated one by one or in any combination. Configuration is done by setting/unsetting values in Zend/zend_tmp_sth.h before compilation.
Please run configure with the '--disable-phar' option when testing this, as building phar.phar breaks when 'null to string' conversion is disabled (this is caused by a bug in phar code, and I don't have time to fix it).
The set of available flags will be extended when needed to propose additional restrictions or changes in behavior.
This conditional stuff is temporary and exists only as an addtional help for testing potential BC breaks before a final ruleset is voted upon. It will in no way be kept in the future released code.