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

Allow substr functions to accept null lengths #4840

Closed
wants to merge 2 commits into from

Conversation

colinodell
Copy link
Contributor

@colinodell colinodell commented Oct 21, 2019

This PR allows the *substr* class of functions to accept a null length just like mb_substr() does. This includes:

  • substr()
  • substr_count()
  • substr_compare()
  • iconv_substr()

Original discussion: https://externals.io/message/107600

ext/standard/string.c Outdated Show resolved Hide resolved
If a null $length is passed to any of these functions, behave as if no
parameter was passed:

 - substr()
 - substr_count()
 - substr_compare()
 - iconv_substr()
@colinodell colinodell changed the title Allow substr() length to be null Allow substr functions to accept null lengths Oct 22, 2019
@colinodell
Copy link
Contributor Author

There were three other *substr* functions which I've also modified to accept a null length for consistency.

@nikic
Copy link
Member

nikic commented Oct 22, 2019

Merged as 8ccd58b and e6d3146. Thanks!

@nikic nikic closed this Oct 22, 2019
@colinodell colinodell deleted the substr-null-length branch October 22, 2019 10:13
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.

None yet

2 participants