1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Issue #2990 - unserialize BC fix.

This commit is contained in:
Cameron 2019-05-22 13:57:26 -07:00
parent 6664e9d7ef
commit 6849a47545

View File

@ -433,7 +433,8 @@ class e_array {
$ArrayData = $sourceArrayData; $ArrayData = $sourceArrayData;
if ($ArrayData == ""){ if ($ArrayData == "")
{
return false; return false;
} }
@ -448,8 +449,7 @@ class e_array {
$dat = unserialize($ArrayData); $dat = unserialize($ArrayData);
$ArrayData = $this->WriteArray($dat,FALSE); $ArrayData = $this->WriteArray($dat,FALSE);
} }
elseif(strpos($ArrayData,'{') === 0 || strpos($ArrayData,'[') === 0) // json
if(substr($ArrayData,0,1) === '{' || substr($ArrayData,0,1) === '[') // json
{ {
$dat = json_decode($ArrayData, true); $dat = json_decode($ArrayData, true);
@ -484,6 +484,10 @@ class e_array {
{ {
$ArrayData = stripslashes($ArrayData); $ArrayData = stripslashes($ArrayData);
} }
elseif(strpos($ArrayData,'array') === 0 && strpos($ArrayData,"\' => \'") !== false)
{
$ArrayData = stripslashes($ArrayData);
}
$ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. . $ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. .
@ -516,10 +520,11 @@ class e_array {
echo "<pre>"; echo "<pre>";
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
echo "</pre>"; echo "</pre>";
file_put_contents(e_LOG.'unserializeError_'.time().'.log', $sourceArrayData);
} }
e107::getAdminLog()->addError($sourceArrayData)->toFile('unserializeError_'.time().'.log','e107::unserialize',false); // e107::getAdminLog()->addError($sourceArrayData)->toFile('unserializeError_'.time().'.log','e107::unserialize',false);
return array(); return array();
@ -533,6 +538,12 @@ class e_array {
if (!isset($data) || !is_array($data)) if (!isset($data) || !is_array($data))
{ {
trigger_error("Bad stored array data - <br /><br />".htmlentities($ArrayData), E_USER_ERROR); trigger_error("Bad stored array data - <br /><br />".htmlentities($ArrayData), E_USER_ERROR);
if(e_DEBUG === true)
{
file_put_contents(e_LOG.'unserializeError_'.time().'.log', $sourceArrayData);
}
return false; return false;
} }