Skip to content

Use ASCII lower case for misc case folding #7511

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions ext/intl/grapheme/grapheme_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#include <unicode/ustring.h>
#include <unicode/ubrk.h>

#include "ext/standard/php_string.h"

/* }}} */

#define GRAPHEME_EXTRACT_TYPE_COUNT 0
Expand Down Expand Up @@ -179,9 +177,9 @@ PHP_FUNCTION(grapheme_stripos)
char *haystack_dup, *needle_dup;
int32_t noffset = offset >= 0 ? offset : (int32_t)haystack_len + offset;
needle_dup = estrndup(needle, needle_len);
php_strtolower(needle_dup, needle_len);
zend_str_tolower(needle_dup, needle_len);
haystack_dup = estrndup(haystack, haystack_len);
php_strtolower(haystack_dup, haystack_len);
zend_str_tolower(haystack_dup, haystack_len);

found = php_memnstr(haystack_dup + noffset, needle_dup, needle_len, haystack_dup + haystack_len);

Expand Down Expand Up @@ -295,9 +293,9 @@ PHP_FUNCTION(grapheme_strripos)
char *needle_dup, *haystack_dup;

needle_dup = estrndup(needle, needle_len);
php_strtolower(needle_dup, needle_len);
zend_str_tolower(needle_dup, needle_len);
haystack_dup = estrndup(haystack, haystack_len);
php_strtolower(haystack_dup, haystack_len);
zend_str_tolower(haystack_dup, haystack_len);

ret_pos = grapheme_strrpos_ascii(haystack_dup, haystack_len, needle_dup, needle_len, offset);

Expand Down
4 changes: 2 additions & 2 deletions ext/ldap/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#define __STDC__ 1
#endif

#include "ext/standard/php_string.h"
#include "ext/standard/info.h"

#ifdef HAVE_LDAP_SASL
Expand Down Expand Up @@ -2012,7 +2011,8 @@ PHP_FUNCTION(ldap_get_entries)
ldap_value_free_len(ldap_value);

attr_len = strlen(attribute);
zend_hash_str_update(Z_ARRVAL(tmp1), php_strtolower(attribute, attr_len), attr_len, &tmp2);
zend_str_tolower(attribute, attr_len);
zend_hash_str_update(Z_ARRVAL(tmp1), attribute, attr_len, &tmp2);
add_index_string(&tmp1, num_attrib, attribute);

num_attrib++;
Expand Down
4 changes: 2 additions & 2 deletions ext/oci8/oci8.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
smart_str_0(&hashed_details);

/* make it lowercase */
php_strtolower(ZSTR_VAL(hashed_details.s), ZSTR_LEN(hashed_details.s));
zend_str_tolower(ZSTR_VAL(hashed_details.s), ZSTR_LEN(hashed_details.s));

if (!exclusive && !new_password) {
bool found = 0;
Expand Down Expand Up @@ -2163,7 +2163,7 @@ static php_oci_spool *php_oci_get_spool(char *username, int username_len, char *
/* Session Pool Hash Key : oci8spool***username**edition**hashedpassword**dbname**charset */

smart_str_0(&spool_hashed_details);
php_strtolower(ZSTR_VAL(spool_hashed_details.s), ZSTR_LEN(spool_hashed_details.s));
zend_str_tolower(ZSTR_VAL(spool_hashed_details.s), ZSTR_LEN(spool_hashed_details.s));
/* }}} */

spool_out_zv = zend_hash_find(&EG(persistent_list), spool_hashed_details.s);
Expand Down
6 changes: 4 additions & 2 deletions ext/soap/php_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,8 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
char *tmp = estrdup(function->functionName);
int len = strlen(tmp);

if (zend_hash_str_add_ptr(&ctx.sdl->functions, php_strtolower(tmp, len), len, function) == NULL) {
zend_str_tolower(tmp, len);
if (zend_hash_str_add_ptr(&ctx.sdl->functions, tmp, len, function) == NULL) {
zend_hash_next_index_insert_ptr(&ctx.sdl->functions, function);
}
efree(tmp);
Expand All @@ -1139,7 +1140,8 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
}
tmp = estrdup(function->requestName);
len = strlen(tmp);
zend_hash_str_add_ptr(ctx.sdl->requests, php_strtolower(tmp, len), len, function);
zend_str_tolower(tmp, len);
zend_hash_str_add_ptr(ctx.sdl->requests, tmp, len, function);
efree(tmp);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4070,7 +4070,7 @@ static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name) /* {{{

int len = strlen(function_name);
char *str = estrndup(function_name,len);
php_strtolower(str,len);
zend_str_tolower(str,len);
if (sdl != NULL) {
if ((tmp = zend_hash_str_find_ptr(&sdl->functions, str, len)) != NULL) {
efree(str);
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ PHP_FUNCTION(get_meta_tags)
} else if (tok == TOK_CLOSETAG) {
if (have_name) {
/* For BC */
php_strtolower(name, strlen(name));
zend_str_tolower(name, strlen(name));
if (have_content) {
add_assoc_string(return_value, name, value);
} else {
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/http_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
}

/* Make lowercase for easy comparison against 'standard' headers */
php_strtolower(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
zend_str_tolower(ZSTR_VAL(tmp), ZSTR_LEN(tmp));
t = ZSTR_VAL(tmp);

if (!header_init) {
Expand Down
3 changes: 1 addition & 2 deletions ext/standard/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <sys/utsname.h>
#endif
#include "url.h"
#include "php_string.h"

#ifdef PHP_WIN32
# include "winver.h"
Expand Down Expand Up @@ -135,7 +134,7 @@ PHPAPI ZEND_COLD void php_info_print_module(zend_module_entry *zend_module) /* {
if (!sapi_module.phpinfo_as_text) {
zend_string *url_name = php_url_encode(zend_module->name, strlen(zend_module->name));

php_strtolower(ZSTR_VAL(url_name), ZSTR_LEN(url_name));
zend_str_tolower(ZSTR_VAL(url_name), ZSTR_LEN(url_name));
php_info_printf("<h2><a name=\"module_%s\">%s</a></h2>\n", ZSTR_VAL(url_name), zend_module->name);

efree(url_name);
Expand Down
4 changes: 2 additions & 2 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include "php_syslog.h"
#include "fopen_wrappers.h"
#include "ext/standard/php_standard.h"
#include "ext/standard/php_string.h"
#include "ext/date/php_date.h"
#include "php_variables.h"
#include "ext/standard/credits.h"
Expand Down Expand Up @@ -1013,7 +1012,8 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
while((p = strchr(docref_buf, '_')) != NULL) {
*p = '-';
}
docref = php_strtolower(docref_buf, doclen);
zend_str_tolower(docref_buf, doclen);
docref = docref_buf;
}

/* we have a docref for a function AND
Expand Down
3 changes: 1 addition & 2 deletions main/rfc1867.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "php_globals.h"
#include "php_variables.h"
#include "rfc1867.h"
#include "ext/standard/php_string.h"
#include "zend_smart_string.h"

#ifndef DEBUG_FILE_UPLOAD
Expand Down Expand Up @@ -714,7 +713,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
int content_type_len = (int)strlen(content_type_dup);
char *content_type_lcase = estrndup(content_type_dup, content_type_len);

php_strtolower(content_type_lcase, content_type_len);
zend_str_tolower(content_type_lcase, content_type_len);
boundary = strstr(content_type_lcase, "boundary");
if (boundary) {
boundary = content_type_dup + (boundary - content_type_lcase);
Expand Down
2 changes: 1 addition & 1 deletion main/streams/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, protocol, n))) {
char *tmp = estrndup(protocol, n);

php_strtolower(tmp, n);
zend_str_tolower(tmp, n);
if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, tmp, n))) {
char wrapper_name[32];

Expand Down