From 6cb3292c5ce61b99aecc800ea43895f8f98136ba Mon Sep 17 00:00:00 2001 From: Jack Kwakman Date: Mon, 23 Jan 2017 11:22:22 +0100 Subject: [PATCH 1/2] Removed php @ warning suppression Anonymous function handling was causing massive warnings in our API logs: Severity: Warning --> get_class() expects parameter 1 to be object, string given get_class can only be used on objects so it is quite safe to first check if we have an object. Otherwise E_WARNINGS are thrown. --- src/SimpleValidator/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SimpleValidator/Validator.php b/src/SimpleValidator/Validator.php index 2d32226..c1f316e 100644 --- a/src/SimpleValidator/Validator.php +++ b/src/SimpleValidator/Validator.php @@ -231,7 +231,7 @@ public static function validate($inputs, $rules, $naming = null) { /** * Handle anonymous functions */ - if (@get_class($closure) == 'Closure') { + if(is_object($example) && get_class($example) == 'Closure') { $refl_func = new \ReflectionFunction($closure); $validation = $refl_func->invokeArgs($params); }/** From 4dc68bbddb7de0aa5b5c6d1d9dc40b3507dd9903 Mon Sep 17 00:00:00 2001 From: Jack Kwakman Date: Mon, 23 Jan 2017 11:32:49 +0100 Subject: [PATCH 2/2] Update Validator.php --- src/SimpleValidator/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SimpleValidator/Validator.php b/src/SimpleValidator/Validator.php index c1f316e..f59ae56 100644 --- a/src/SimpleValidator/Validator.php +++ b/src/SimpleValidator/Validator.php @@ -231,7 +231,7 @@ public static function validate($inputs, $rules, $naming = null) { /** * Handle anonymous functions */ - if(is_object($example) && get_class($example) == 'Closure') { + if(is_object($closure) && get_class($closure) == 'Closure') { $refl_func = new \ReflectionFunction($closure); $validation = $refl_func->invokeArgs($params); }/**