diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb921c831..362c5f7b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@
1. [](#improved)
* Improved error detection for broken Flex Objects
* Removed apc and xcache support, made apc alias of apcu
+1. [](#bugfix)
* Fixed non-namespaced exceptions in scheduler
# v1.6.0-rc.1
@@ -15,11 +16,10 @@
* Improved `$page->forms()` call, added `$page->addForms()`
* Made `FormFlashFile` more robust against deleted files
* Updated languages from crowdin
-1. [](#bugfix)
* Fixed a bug in `FormFlashFile::moveTo()` not deleting the old file
* Fixed `FlexMediaTrait::getMedia()` trying to include uploaded but already moved media
* Fixed `ImageMedium` constructor warning when file does not exist
- * Fixed bad host header in PSR-7 (if using 'php -S localhost:8000 system/router.php')
+ * Fixed bad host header in PSR-7 (if using `php -S localhost:8000 system/router.php`)
# v1.6.0-beta.8
## 01/25/2019
diff --git a/system/src/Grav/Common/Errors/Errors.php b/system/src/Grav/Common/Errors/Errors.php
index 49f64c13d..a77cbc42d 100644
--- a/system/src/Grav/Common/Errors/Errors.php
+++ b/system/src/Grav/Common/Errors/Errors.php
@@ -50,17 +50,8 @@ class Errors
break;
}
- if (method_exists('Whoops\Util\Misc', 'isAjaxRequest')) { //Whoops 2.0
- if (Whoops\Util\Misc::isAjaxRequest() || $jsonRequest) {
- $whoops->pushHandler(new Whoops\Handler\JsonResponseHandler);
- }
- } elseif (function_exists('Whoops\isAjaxRequest')) { //Whoops 2.0.0-alpha
- if (Whoops\isAjaxRequest() || $jsonRequest) {
- $whoops->pushHandler(new Whoops\Handler\JsonResponseHandler);
- }
- } else { //Whoops 1.x
- $json_page = new Whoops\Handler\JsonResponseHandler;
- $json_page->onlyForAjaxRequests(true);
+ if (Whoops\Util\Misc::isAjaxRequest() || $jsonRequest) {
+ $whoops->pushHandler(new Whoops\Handler\JsonResponseHandler);
}
if (isset($config['log']) && $config['log']) {
diff --git a/system/src/Grav/Common/GPM/AbstractCollection.php b/system/src/Grav/Common/GPM/AbstractCollection.php
index e6f7481f5..a9e1ac975 100644
--- a/system/src/Grav/Common/GPM/AbstractCollection.php
+++ b/system/src/Grav/Common/GPM/AbstractCollection.php
@@ -15,13 +15,7 @@ abstract class AbstractCollection extends Iterator
{
public function toJson()
{
- $items = [];
-
- foreach ($this->items as $name => $package) {
- $items[$name] = $package->toArray();
- }
-
- return json_encode($items);
+ return json_encode($this->toArray());
}
public function toArray()
diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php
index 7368948b2..2ba23b5b8 100644
--- a/system/src/Grav/Common/Twig/TwigExtension.php
+++ b/system/src/Grav/Common/Twig/TwigExtension.php
@@ -212,13 +212,10 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn
public function safeEmailFilter($str)
{
$email = '';
- for ( $i = 0, $len = strlen( $str ); $i < $len; $i++ ) {
- $j = mt_rand( 0, 1);
- if ( $j === 0 ) {
- $email .= '' . ord( $str[$i] ) . ';';
- } elseif ( $j === 1 ) {
- $email .= $str[$i];
- }
+ for ($i = 0, $len = strlen($str); $i < $len; $i++) {
+ $j = random_int(0, 1);
+
+ $email .= $j === 0 ? '' . ord($str[$i]) . ';' : $str[$i];
}
return str_replace('@', '@', $email);
@@ -498,7 +495,7 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn
$now = time();
// check if unix timestamp
- if ((string)(int)$date == $date) {
+ if ((string)(int)$date === (string)$date) {
$unix_date = $date;
} else {
$unix_date = strtotime($date);
diff --git a/system/src/Grav/Console/Gpm/DirectInstallCommand.php b/system/src/Grav/Console/Gpm/DirectInstallCommand.php
index 84d588eb7..6e0444534 100644
--- a/system/src/Grav/Console/Gpm/DirectInstallCommand.php
+++ b/system/src/Grav/Console/Gpm/DirectInstallCommand.php
@@ -150,20 +150,20 @@ class DirectInstallCommand extends ConsoleCommand
$blueprint = GPM::getBlueprints($extracted);
if ($blueprint) {
if (isset($blueprint['dependencies'])) {
- $depencencies = [];
+ $dependencies = [];
foreach ($blueprint['dependencies'] as $dependency) {
if (is_array($dependency)){
if (isset($dependency['name'])) {
- $depencencies[] = $dependency['name'];
+ $dependencies[] = $dependency['name'];
}
if (isset($dependency['github'])) {
- $depencencies[] = $dependency['github'];
+ $dependencies[] = $dependency['github'];
}
} else {
- $depencencies[] = $dependency;
+ $dependencies[] = $dependency;
}
}
- $this->output->writeln(' |- Dependencies found... [' . implode(',', $depencencies) . ']');
+ $this->output->writeln(' |- Dependencies found... [' . implode(',', $dependencies) . ']');
$question = new ConfirmationQuestion(" | '- Dependencies will not be satisfied. Continue ? [y|N] ", false);
$answer = $this->all_yes ? true : $helper->ask($this->input, $this->output, $question);