1
0
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:
Cameron
2020-12-14 07:27:51 -08:00
parent d5a1e77ca1
commit 2a31f831a9
2 changed files with 8 additions and 10 deletions

View File

@@ -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.