File tree 1 file changed +22
-18
lines changed
1 file changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -1462,29 +1462,33 @@ PHPAPI zend_string *php_string_tolower(zend_string *s)
1462
1462
unsigned char * c ;
1463
1463
const unsigned char * e ;
1464
1464
1465
- c = (unsigned char * )ZSTR_VAL (s );
1466
- e = c + ZSTR_LEN (s );
1465
+ if (EXPECTED (!BG (locale_changed ))) {
1466
+ return zend_string_tolower (s );
1467
+ } else {
1468
+ c = (unsigned char * )ZSTR_VAL (s );
1469
+ e = c + ZSTR_LEN (s );
1467
1470
1468
- while (c < e ) {
1469
- if (isupper (* c )) {
1470
- register unsigned char * r ;
1471
- zend_string * res = zend_string_alloc (ZSTR_LEN (s ), 0 );
1471
+ while (c < e ) {
1472
+ if (isupper (* c )) {
1473
+ register unsigned char * r ;
1474
+ zend_string * res = zend_string_alloc (ZSTR_LEN (s ), 0 );
1472
1475
1473
- if (c != (unsigned char * )ZSTR_VAL (s )) {
1474
- memcpy (ZSTR_VAL (res ), ZSTR_VAL (s ), c - (unsigned char * )ZSTR_VAL (s ));
1475
- }
1476
- r = c + (ZSTR_VAL (res ) - ZSTR_VAL (s ));
1477
- while (c < e ) {
1478
- * r = tolower (* c );
1479
- r ++ ;
1480
- c ++ ;
1476
+ if (c != (unsigned char * )ZSTR_VAL (s )) {
1477
+ memcpy (ZSTR_VAL (res ), ZSTR_VAL (s ), c - (unsigned char * )ZSTR_VAL (s ));
1478
+ }
1479
+ r = c + (ZSTR_VAL (res ) - ZSTR_VAL (s ));
1480
+ while (c < e ) {
1481
+ * r = tolower (* c );
1482
+ r ++ ;
1483
+ c ++ ;
1484
+ }
1485
+ * r = '\0' ;
1486
+ return res ;
1481
1487
}
1482
- * r = '\0' ;
1483
- return res ;
1488
+ c ++ ;
1484
1489
}
1485
- c ++ ;
1490
+ return zend_string_copy ( s ) ;
1486
1491
}
1487
- return zend_string_copy (s );
1488
1492
}
1489
1493
/* }}} */
1490
1494
You can’t perform that action at this time.
0 commit comments