com php-src: Remove zpp L specifier: UPGRADING.INTERNALS Zend/zend_API.c Zend/zend_API.h
| From: | Nikita Popov | Date: | Mon, 03 Jun 2019 07:39:17 +0000 |
| Subject: | com php-src: Remove zpp L specifier: UPGRADING.INTERNALS Zend/zend_API.c Zend/zend_API.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106521@lists.php.net to get a copy of this message | ||
Commit: 8a0965e3d694037837a8f70f280e7d14dd7778eb
Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 3 Jun 2019 09:39:17 +0200
Parents: b1e52cab62696f3da77017c4a56faa29dfec992c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8a0965e3d694037837a8f70f280e7d14dd7778eb
Log:
Remove zpp L specifier
We don't use this internally anymore, and external usages should
be encouraged to move towards 'l'.
Changed paths:
M UPGRADING.INTERNALS
M Zend/zend_API.c
M Zend/zend_API.h
Diff:
diff --git a/UPGRADING..INTERNALS b/UPGRADING.INTERNALS
index 41c270a..5580145 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -5,6 +5,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
b. ZEND_OVERLOADED_FUNCTION and corresponding call_method() object handler
c. TSRM changes
d. get() and set() object handlers
+ e. zend_parse_parameters 'L' specifier
2. Build system changes
a. Abstract
@@ -47,6 +48,9 @@ PHP 8.0 INTERNALS UPGRADE NOTES
functionality should be provided in some other way (for example, as
modification of an object property).
+ e. The zend_parse_parameters 'L' specifier and the Z_PARAM_STRICT_LONG()
+ family of macros have been removed. Use 'l' and Z_PARAM_LONG() insead,
+ which, despite the confusing name, actually have stricter input validation.
========================
2. Build system changes
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 0770b97..d588266 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -343,47 +343,6 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest)
}
/* }}} */
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest) /* {{{ */
-{
- if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
- if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
- return 0;
- }
- *dest = zend_dval_to_lval_cap(Z_DVAL_P(arg));
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
- double d;
- int type;
-
- if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
- if (EXPECTED(type != 0)) {
- if (UNEXPECTED(zend_isnan(d))) {
- return 0;
- }
- *dest = zend_dval_to_lval_cap(d);
- } else {
- return 0;
- }
- }
- } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
- *dest = 0;
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
- *dest = 1;
- } else {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest) /* {{{ */
-{
- if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
- return 0;
- }
- return zend_parse_arg_long_cap_weak(arg, dest);
-}
-/* }}} */
-
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
@@ -481,7 +440,6 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
switch (c) {
case 'l':
- case 'L':
{
zend_long *p = va_arg(*va, zend_long *);
zend_bool *is_null = NULL;
@@ -490,7 +448,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
is_null = va_arg(*va, zend_bool *);
}
- if (!zend_parse_arg_long(arg, p, is_null, check_null, c == 'L')) {
+ if (!zend_parse_arg_long(arg, p, is_null, check_null)) {
return "int";
}
}
@@ -688,9 +646,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
break;
- case 'Z':
- /* 'Z' iz not supported anymore and should be replaced with 'z' */
- ZEND_ASSERT(c != 'Z');
+ case 'Z': /* replace with 'z' */
+ case 'L': /* replace with 'l' */
+ ZEND_ASSERT(0 && "ZPP modifier no longer supported");
default:
return "unknown";
}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 6d77fb7..8b53464 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -1331,7 +1331,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char
*e
/* old "l" */
#define Z_PARAM_LONG_EX2(dest, is_null, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 0))) { \
+ if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null))) { \
_expected_type = Z_EXPECTED_LONG; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@@ -1343,21 +1343,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char
*e
#define Z_PARAM_LONG(dest) \
Z_PARAM_LONG_EX(dest, _dummy, 0, 0)
-/* old "L" */
-#define Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, deref, separate) \
- Z_PARAM_PROLOGUE(deref, separate); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 1))) { \
- _expected_type = Z_EXPECTED_LONG; \
- _error_code = ZPP_ERROR_WRONG_ARG; \
- break; \
- }
-
-#define Z_PARAM_STRICT_LONG_EX(dest, is_null, check_null, separate) \
- Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, separate, separate)
-
-#define Z_PARAM_STRICT_LONG(dest) \
- Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0)
-
/* old "o" */
#define Z_PARAM_OBJECT_EX2(dest, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
@@ -1514,8 +1499,6 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool
*dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest);
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest);
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest);
@@ -1539,7 +1522,7 @@ static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest,
ze
return 1;
}
-static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null,
int check_null, int cap)
+static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null,
int check_null)
{
if (check_null) {
*is_null = 0;
@@ -1549,8 +1532,6 @@ static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest,
ze
} else if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*is_null = 1;
*dest = 0;
- } else if (cap) {
- return zend_parse_arg_long_cap_slow(arg, dest);
} else {
return zend_parse_arg_long_slow(arg, dest);
}