Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use preg_split instead of preg_match with quantifiers in safe_substr.#123

Merged
danielbachhuber merged 1 commit into
masterwp-cli/php-cli-tools:masterfrom
use_preg_split_in_safe_substrwp-cli/php-cli-tools:use_preg_split_in_safe_substrCopy head branch name to clipboard
Oct 12, 2017
Merged

Use preg_split instead of preg_match with quantifiers in safe_substr.#123
danielbachhuber merged 1 commit into
masterwp-cli/php-cli-tools:masterfrom
use_preg_split_in_safe_substrwp-cli/php-cli-tools:use_preg_split_in_safe_substrCopy head branch name to clipboard

Conversation

@gitlost

@gitlost gitlost commented Oct 12, 2017

Copy link
Copy Markdown
Contributor

Fixes wp-cli/db-command#54

Uses preg_split() instead of preg_match() with quantifiers in safe_substr() to avoid 65535 limit on quantifiers (regexp.reference.repetition), encountered for large strings.

Also normalizes the $start arg so its behaviour is the same no matter which substr method gets used.

Also checks that mb_substr() is available before using it in _safe_substr_eaw().

The following was noticed in testing and is unrelated so can do in a separate PR to reduce churn if desirable:

Also adds check that $encoding doesn't evaluate to false before passing it to mbstring functions as they can fail otherwise (seems to be system dependent).

@gitlost gitlost added the bug label Oct 12, 2017
@gitlost gitlost requested a review from a team October 12, 2017 19:55

@miya0001 miya0001 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, great...
Looks good to me, because there are no removed tests and some tests are added. 😊

@gitlost gitlost added this to the 0.11.8 milestone Oct 12, 2017
@danielbachhuber danielbachhuber merged commit 363c753 into master Oct 12, 2017
@danielbachhuber danielbachhuber deleted the use_preg_split_in_safe_substr branch October 12, 2017 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.