Skip to content

Commit ceb4934

Browse files
authored
zend_operators: Remove zend_binary_zval_str(n)cmp() (#22298)
1 parent d7e4fc7 commit ceb4934

3 files changed

Lines changed: 4 additions & 14 deletions

File tree

UPGRADING.INTERNALS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
103103
. The deprecated Z_IMMUTABLE(), Z_IMMUTABLE_P(), Z_OPT_IMMUTABLE(), and
104104
Z_OPT_IMMUTABLE_P() macros have been removed. Check for
105105
IS_ARRAY && !REFCOUNTED directly.
106+
. The zend_binary_zval_strcmp() and zend_binary_zval_strncmp() functions
107+
have been removed, because they are unsafe by relying on the zvals
108+
having a specific type. Use zend_binary_strcmp() / zend_binary_strncmp(),
109+
string_compare_function() or similar instead.
106110
. Added zend_fcall_info.consumed_args together with
107111
zend_fci_consumed_arg(), which allows moving a selected callback argument
108112
instead of copying it in zend_call_function(). Currently only a single

Zend/zend_operators.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,18 +3354,6 @@ ZEND_API int ZEND_FASTCALL zend_binary_strncasecmp_l(const char *s1, size_t len1
33543354
}
33553355
/* }}} */
33563356

3357-
ZEND_API int ZEND_FASTCALL zend_binary_zval_strcmp(const zval *s1, const zval *s2) /* {{{ */
3358-
{
3359-
return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2));
3360-
}
3361-
/* }}} */
3362-
3363-
ZEND_API int ZEND_FASTCALL zend_binary_zval_strncmp(const zval *s1, const zval *s2, const zval *s3) /* {{{ */
3364-
{
3365-
return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRLEN_P(s1), Z_STRVAL_P(s2), Z_STRLEN_P(s2), Z_LVAL_P(s3));
3366-
}
3367-
/* }}} */
3368-
33693357
ZEND_API bool ZEND_FASTCALL zendi_smart_streq(const zend_string *s1, const zend_string *s2) /* {{{ */
33703358
{
33713359
uint8_t ret1, ret2;

Zend/zend_operators.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,6 @@ static zend_always_inline zend_string* zend_string_toupper(zend_string *str) {
487487
return zend_string_toupper_ex(str, false);
488488
}
489489

490-
ZEND_API int ZEND_FASTCALL zend_binary_zval_strcmp(const zval *s1, const zval *s2);
491-
ZEND_API int ZEND_FASTCALL zend_binary_zval_strncmp(const zval *s1, const zval *s2, const zval *s3);
492490
ZEND_API int ZEND_FASTCALL zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2);
493491
ZEND_API int ZEND_FASTCALL zend_binary_strncmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
494492
ZEND_API int ZEND_FASTCALL zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2);

0 commit comments

Comments
 (0)