Opened 5 years ago

Closed 5 years ago

#963 closed Bug (fixed)

sanitizeInputValues() gives a warning when type is set to 'numeric' and it must return the default

Reported by: mgc8 Owned by:
Priority: normal Milestone: Piwik 0.4.4
Component: Core Keywords: sanitizeInputValues, settype, numeric
Cc: Sensitive: no


The function accepts a $varType of 'numeric' which it interprets as either 'int' or 'float', and when the value does not match any of these, it must return the $varDefault parameter. However, the following line:

settype($varDefault, $varType);

gives a warning sine 'numeric' is not a valid settype parameter.

Change History (4)

comment:1 Changed 5 years ago by vipsoft (robocoder)

  • Milestone set to 1 - Piwik 0.4.4

Propose to remove the 'numeric' case, and change all affected getRequestVar() calls to 'int'. (A quick grep shows it only used to get the 'h', 'm', and 's' parameters.)

comment:2 Changed 5 years ago by vipsoft (robocoder)

Matt: in getRequestVar(), should we remove the 'array' case too? I don't believe it's possible to pass an array as a GET/POST parameter (except as something encoded, e.g., JSON, in which case, it would be a string).

comment:3 Changed 5 years ago by vipsoft (robocoder)

*scratch that last comment* I forgot PHP handles returns an array when the URL contains parameters like this: x[]=1&x[]=3&x[]=4

comment:4 Changed 5 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

In [1450], fixes #963 - remove 'numeric' as a getRequestVar() type

Note: See TracTickets for help on using tickets.