Skip to content
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

Optimize strtolower()/strtoupper() #1673

Merged
merged 1 commit into from
Dec 13, 2015
Merged

Conversation

hnw
Copy link
Contributor

@hnw hnw commented Dec 13, 2015

In PHP 7, unnecessary string copy is decreased from PHP 5 because of reference counting in zend_string. For example, return value of strtolower("abc") points the original zend_string and never duplicate the string.

However, strtolower("abc1") causes memory allocation. The current implementation of strtolower requires that all characters satisfy islower(c) for avoiding the string duplication. It seems too strict and inaccurate.

@laruence
Copy link
Member

Nice catch... thanks

@php-pulls php-pulls merged commit fa78da9 into php:master Dec 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants