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

[5.1] Fixed support for PHP 7.1 #14549

Merged
merged 3 commits into from
Aug 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

env:
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/ArrayStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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 @@ -159,7 +159,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
4 changes: 4 additions & 0 deletions tests/Encryption/EncrypterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public function testOpenSslEncrypterCanDecryptMcryptedData()
$this->markTestSkipped('Mcrypt module not installed');
}

if (version_compare(PHP_VERSION, '7.1') > 0) {
$this->markTestSkipped('Not compatable with PHP 7.1+');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still install the mcrypt extension on PHP 7.1 (infact, travis has), but running it fail the tests due to the deprecation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "compatible" ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the comparison operator should be >= 0, or you can do if (version_compare(PHP_VERSION, '7.1', '>='))


$key = Str::random(32);
$encrypter = new Illuminate\Encryption\McryptEncrypter($key);
$encrypted = $encrypter->encrypt('foo');
Expand Down