Skip to content

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