Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2018-09-30 23:43:06 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2018-09-30 23:43:06 +0300
commit019ce0114819d2a88a535fd0f122244ed3406bfa (patch)
treef7974f2419a52678e1a403b4ca0cb54b0daf140a /plugins/ExampleAPI
parent0e3702128ab244017339fcee5895b835f8b76de2 (diff)
Fix various notices caused by invalid parameter values (#13511)
* Properly check dates used for period factory * Properly check given idSite for rowevolution * Improve example API to check given parameter type * cast idSite parameter in ImageGraph API method
Diffstat (limited to 'plugins/ExampleAPI')
-rw-r--r--plugins/ExampleAPI/API.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/ExampleAPI/API.php b/plugins/ExampleAPI/API.php
index d508011d3f..6435de7e9a 100644
--- a/plugins/ExampleAPI/API.php
+++ b/plugins/ExampleAPI/API.php
@@ -76,6 +76,10 @@ class API extends \Piwik\Plugin\API
*/
public function getSum($a = 0, $b = 0)
{
+ if (!is_numeric($a) || !is_numeric($b)) {
+ throw new \Exception('Given parameters need to be numeric');
+ }
+
return (float)($a + $b);
}