LowExpiryCacheTimeSniff: Account for random generating number func#445
Open
rebeccahum wants to merge 1 commit intodevelopfrom
Open
LowExpiryCacheTimeSniff: Account for random generating number func#445rebeccahum wants to merge 1 commit intodevelopfrom
rebeccahum wants to merge 1 commit intodevelopfrom
Conversation
…ns used as cache expiry time
783c30a to
b1b0393
Compare
GaryJones
requested changes
Jul 3, 2020
| $this->phpcsFile->addWarning( $message, $stackPtr, 'LowCacheTime', $data ); | ||
| $times = []; | ||
| if ( false !== $rand_function ) { | ||
| $times = explode( ',', preg_replace( '/[( )|\(|\)|(' . $rand_function . ')]/', '', $time ) ); |
Contributor
There was a problem hiding this comment.
I think this regex is going to miss cases where there are unusual code styling - line breaks before, between, or after string arguments like 20 * HOUR_IN_SECONDS - I'd at least like to see more unit tests, and I think when we switch to be able to use https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-PassedParameters.html#method_getParameters then this will be much easier to be confident with.
51 tasks
Contributor
|
Conflicts need resolving before it can be reviewed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #408