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

Check that needle is not empty before searching for it. #437

Merged
merged 1 commit into from
Oct 31, 2017

Conversation

donnchawp
Copy link
Contributor

If the CDN setting "Exclude if substring" is blank a warning will be
generated when you look for it. This fixes that and uses stripos instead
of stristr as it's faster.
ref: https://wordpress.org/support/topic/another-empty-needle-issue/

If the CDN setting "Exclude if substring" is blank a warning will be
generated when you look for it. This fixes that and uses stripos instead
of stristr as it's faster.
ref: https://wordpress.org/support/topic/another-empty-needle-issue/
@donnchawp donnchawp merged commit 6ab8160 into master Oct 31, 2017
@donnchawp donnchawp deleted the fix/empty_needle branch October 31, 2017 12:33
@stodorovic
Copy link

stodorovic commented Oct 31, 2017

Just an improvement, it's little faster (and easier) to use array_filter together with array_map. For example:
$arr_of_excludes = array_filter( array_map( 'trim', explode( ',', $ossdl_off_exclude ) ) ) ;

I'm thinking to move this code only on update settings. We should save array instead string, then it's possible to we use quicker way for loading - $ossdl_off_exclude = get_option('ossdl_off_exclude'). Main trouble is function which converts current options into new format. So, it makes sense if we convert more options on this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants