Skip to content

Commit

Permalink
[5.1] Fixed support for PHP 7.1 (laravel#14549)
Browse files Browse the repository at this point in the history
* Test on PHP 7.1

* Fixed cache incrementing on php 7.1

* Skipped the legacy encrypter test on PHP 7.1+
  • Loading branch information
GrahamCampbell authored and tillkruss committed Aug 30, 2016
1 parent 1c27d95 commit 669b6f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/ArrayStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function put($key, $value, $minutes)
*/
public function increment($key, $value = 1)
{
$this->storage[$key] = $this->storage[$key] + $value;
$this->storage[$key] = ((int) $this->storage[$key]) + $value;

return $this->storage[$key];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/DatabaseStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function incrementOrDecrement($key, $value, Closure $callback)
}

$current = $this->encrypter->decrypt($cache->value);
$new = $callback($current, $value);
$new = $callback((int) $current, $value);

if (! is_numeric($current)) {
return false;
Expand Down

0 comments on commit 669b6f6

Please sign in to comment.