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

Commit d68c451

Browse filesBrowse files
[Cache] Using strpbrk() instead of strcspn() is faster
1 parent d631609 commit d68c451
Copy full SHA for d68c451

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎src/Symfony/Component/Cache/CacheItem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/CacheItem.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function expiresAfter($time)
101101
*
102102
* @param string $key The key to validate
103103
*
104-
* @throws InvalidArgumentException When $key is not valid.
104+
* @throws InvalidArgumentException When $key is not valid
105105
*/
106106
public static function validateKey($key)
107107
{
@@ -111,7 +111,7 @@ public static function validateKey($key)
111111
if (!isset($key[0])) {
112112
throw new InvalidArgumentException('Cache key length must be greater than zero');
113113
}
114-
if (isset($key[strcspn($key, '{}()/\@:')])) {
114+
if (false !== strpbrk($key, '{}()/\@:')) {
115115
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key));
116116
}
117117
}

0 commit comments

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