mirror of
https://github.com/e107inc/e107.git
synced 2025-08-12 01:25:01 +02:00
Check variable type during toDB() test. Optimized toDB() for non-string types.
This commit is contained in:
@@ -486,12 +486,14 @@ class e_parse extends e_parser
|
||||
*/
|
||||
public function toDB($data = null, $nostrip =false, $no_encode = false, $mod = false, $parm = null)
|
||||
{
|
||||
if($data === null)
|
||||
$variableType = gettype($data);
|
||||
|
||||
if(($variableType !== 'string' && $variableType !== 'array' ) || $data === '0')
|
||||
{
|
||||
return null;
|
||||
return $data;
|
||||
}
|
||||
|
||||
if (is_array($data))
|
||||
if ($variableType === 'array')
|
||||
{
|
||||
$ret = array();
|
||||
|
||||
@@ -504,17 +506,13 @@ class e_parse extends e_parser
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (MAGIC_QUOTES_GPC == true && $nostrip == false)
|
||||
{
|
||||
$data = stripslashes($data);
|
||||
}
|
||||
|
||||
if(intval($data) === $data || $data === '0') // simple integer.
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
$core_pref = e107::getConfig();
|
||||
|
||||
if ($mod !== 'pReFs') //XXX We're not saving prefs.
|
||||
|
Reference in New Issue
Block a user