From c3c5ef3b0baf1b555870d96d734855da7a537007 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Wed, 22 Nov 2017 19:01:47 +0200 Subject: [PATCH 1/2] make Collection::where independent on error reporting --- src/Illuminate/Routing/Router.php | 6 +++--- src/Illuminate/Support/Collection.php | 30 +++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index adbafaa24844..0096935bf5a5 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -230,9 +230,9 @@ public function fallback($action) /** * Create a redirect from one URI to another. * - * @param string $uri - * @param string $destination - * @param int $status + * @param string $uri + * @param string $destination + * @param int $status * @return \Illuminate\Routing\Route */ public function redirect($uri, $destination, $status = 301) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index d60747b633bb..4d7692dd650b 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -486,23 +486,23 @@ protected function operatorForWhere($key, $operator, $value) return function ($item) use ($key, $operator, $value) { $retrieved = data_get($item, $key); - try { - switch ($operator) { - default: - case '=': - case '==': return $retrieved == $value; - case '!=': - case '<>': return $retrieved != $value; - case '<': return $retrieved < $value; - case '>': return $retrieved > $value; - case '<=': return $retrieved <= $value; - case '>=': return $retrieved >= $value; - case '===': return $retrieved === $value; - case '!==': return $retrieved !== $value; - } - } catch (Exception $e) { + if (count(array_filter([$retrieved, $value], 'is_object')) == 1) { return false; } + + switch ($operator) { + default: + case '=': + case '==': return $retrieved == $value; + case '!=': + case '<>': return $retrieved != $value; + case '<': return $retrieved < $value; + case '>': return $retrieved > $value; + case '<=': return $retrieved <= $value; + case '>=': return $retrieved >= $value; + case '===': return $retrieved === $value; + case '!==': return $retrieved !== $value; + } }; } From 4c040413577538ce143acf64f01ba32e17629730 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Wed, 22 Nov 2017 19:02:27 +0200 Subject: [PATCH 2/2] revert changes --- src/Illuminate/Routing/Router.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 0096935bf5a5..adbafaa24844 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -230,9 +230,9 @@ public function fallback($action) /** * Create a redirect from one URI to another. * - * @param string $uri - * @param string $destination - * @param int $status + * @param string $uri + * @param string $destination + * @param int $status * @return \Illuminate\Routing\Route */ public function redirect($uri, $destination, $status = 301)