Skip to content

Commit 8a244f2

Browse files
Merge branch '3.1' into 3.2
* 3.1: [Cache] Using strpbrk() instead of strcspn() is faster bumped Symfony version to 3.1.10 updated VERSION for 3.1.9 updated CHANGELOG for 3.1.9
2 parents c96ac90 + 2aad68f commit 8a244f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CacheItem.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function expiresAfter($time)
104104
*
105105
* @return static
106106
*
107-
* @throws InvalidArgumentException When $tag is not valid.
107+
* @throws InvalidArgumentException When $tag is not valid
108108
*/
109109
public function tag($tags)
110110
{
@@ -121,7 +121,7 @@ public function tag($tags)
121121
if (!isset($tag[0])) {
122122
throw new InvalidArgumentException('Cache tag length must be greater than zero');
123123
}
124-
if (isset($tag[strcspn($tag, '{}()/\@:')])) {
124+
if (false !== strpbrk($tag, '{}()/\@:')) {
125125
throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters {}()/\@:', $tag));
126126
}
127127
$this->tags[$tag] = $tag;
@@ -135,7 +135,7 @@ public function tag($tags)
135135
*
136136
* @param string $key The key to validate
137137
*
138-
* @throws InvalidArgumentException When $key is not valid.
138+
* @throws InvalidArgumentException When $key is not valid
139139
*/
140140
public static function validateKey($key)
141141
{
@@ -145,7 +145,7 @@ public static function validateKey($key)
145145
if (!isset($key[0])) {
146146
throw new InvalidArgumentException('Cache key length must be greater than zero');
147147
}
148-
if (isset($key[strcspn($key, '{}()/\@:')])) {
148+
if (false !== strpbrk($key, '{}()/\@:')) {
149149
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key));
150150
}
151151
}

0 commit comments

Comments
 (0)