Skip to content

Commit fa60ff6

Browse files
committed
Remove duplicate to lower/upper string APIs
1 parent dd62ec0 commit fa60ff6

File tree

4 files changed

+10
-40
lines changed

4 files changed

+10
-40
lines changed

UPGRADING.INTERNALS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ PHP 8.2 INTERNALS UPGRADE NOTES
2828
========================
2929
3. Module changes
3030
========================
31-
31+
a. ext/standard
32+
- The PHP APIs php_strtoupper(), php_string_toupper(), php_strtolower(),
33+
and php_string_tolower() have been removed.
34+
Use zend_str_toupper(), zend_string_toupper(), zend_str_tolower(),
35+
and zend_string_tolower() respectively instead.
3236
========================
3337
4. OpCode changes
3438
========================

ext/standard/array.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4529,9 +4529,9 @@ PHP_FUNCTION(array_change_key_case)
45294529
entry = zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry);
45304530
} else {
45314531
if (change_to_upper) {
4532-
new_key = php_string_toupper(string_key);
4532+
new_key = zend_string_toupper(string_key);
45334533
} else {
4534-
new_key = php_string_tolower(string_key);
4534+
new_key = zend_string_tolower(string_key);
45354535
}
45364536
entry = zend_hash_update(Z_ARRVAL_P(return_value), new_key, entry);
45374537
zend_string_release_ex(new_key, 0);

ext/standard/php_string.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ PHP_MINIT_FUNCTION(string_intrin);
3535
strnatcmp_ex(a, strlen(a), b, strlen(b), 1)
3636
PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len, int fold_case);
3737
PHPAPI struct lconv *localeconv_r(struct lconv *out);
38-
PHPAPI char *php_strtoupper(char *s, size_t len);
39-
PHPAPI char *php_strtolower(char *s, size_t len);
40-
PHPAPI zend_string *php_string_toupper(zend_string *s);
41-
PHPAPI zend_string *php_string_tolower(zend_string *s);
4238
PHPAPI char *php_strtr(char *str, size_t len, const char *str_from, const char *str_to, size_t trlen);
4339
PHPAPI zend_string *php_addslashes(zend_string *str);
4440
PHPAPI void php_stripslashes(zend_string *str);

ext/standard/string.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,21 +1343,6 @@ PHP_FUNCTION(strtok)
13431343
}
13441344
/* }}} */
13451345

1346-
/* {{{ php_strtoupper */
1347-
PHPAPI char *php_strtoupper(char *s, size_t len)
1348-
{
1349-
zend_str_toupper(s, len);
1350-
return s;
1351-
}
1352-
/* }}} */
1353-
1354-
/* {{{ php_string_toupper */
1355-
PHPAPI zend_string *php_string_toupper(zend_string *s)
1356-
{
1357-
return zend_string_toupper(s);
1358-
}
1359-
/* }}} */
1360-
13611346
/* {{{ Makes a string uppercase */
13621347
PHP_FUNCTION(strtoupper)
13631348
{
@@ -1371,21 +1356,6 @@ PHP_FUNCTION(strtoupper)
13711356
}
13721357
/* }}} */
13731358

1374-
/* {{{ php_strtolower */
1375-
PHPAPI char *php_strtolower(char *s, size_t len)
1376-
{
1377-
zend_str_tolower(s, len);
1378-
return s;
1379-
}
1380-
/* }}} */
1381-
1382-
/* {{{ php_string_tolower */
1383-
PHPAPI zend_string *php_string_tolower(zend_string *s)
1384-
{
1385-
return zend_string_tolower(s);
1386-
}
1387-
/* }}} */
1388-
13891359
/* {{{ Makes a string lowercase */
13901360
PHP_FUNCTION(strtolower)
13911361
{
@@ -3120,7 +3090,7 @@ static zend_string *php_str_to_str_i_ex(zend_string *haystack, const char *lc_ha
31203090
char *e;
31213091

31223092
if (ZSTR_LEN(needle) == str_len) {
3123-
lc_needle = php_string_tolower(needle);
3093+
lc_needle = zend_string_tolower(needle);
31243094
end = lc_haystack + ZSTR_LEN(haystack);
31253095
for (p = lc_haystack; (r = (char*)php_memnstr(p, ZSTR_VAL(lc_needle), ZSTR_LEN(lc_needle), end)); p = r + ZSTR_LEN(lc_needle)) {
31263096
if (!new_str) {
@@ -3141,7 +3111,7 @@ static zend_string *php_str_to_str_i_ex(zend_string *haystack, const char *lc_ha
31413111
const char *n;
31423112
const char *endp = o + ZSTR_LEN(haystack);
31433113

3144-
lc_needle = php_string_tolower(needle);
3114+
lc_needle = zend_string_tolower(needle);
31453115
n = ZSTR_VAL(lc_needle);
31463116

31473117
while ((o = (char*)php_memnstr(o, n, ZSTR_LEN(lc_needle), endp))) {
@@ -3185,7 +3155,7 @@ static zend_string *php_str_to_str_i_ex(zend_string *haystack, const char *lc_ha
31853155
nothing_todo:
31863156
return zend_string_copy(haystack);
31873157
} else {
3188-
lc_needle = php_string_tolower(needle);
3158+
lc_needle = zend_string_tolower(needle);
31893159

31903160
if (memcmp(lc_haystack, ZSTR_VAL(lc_needle), ZSTR_LEN(lc_needle))) {
31913161
zend_string_release_ex(lc_needle, 0);

0 commit comments

Comments
 (0)