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;
if ($ArrayData == ""){
if ($ArrayData == "")
{
return false;
}
@ -448,8 +449,7 @@ class e_array {
$dat = unserialize($ArrayData);
$ArrayData = $this->WriteArray($dat,FALSE);
}
if(substr($ArrayData,0,1) === '{' || substr($ArrayData,0,1) === '[') // json
elseif(strpos($ArrayData,'{') === 0 || strpos($ArrayData,'[') === 0) // json
{
$dat = json_decode($ArrayData, true);
@ -484,6 +484,10 @@ class e_array {
{
$ArrayData = stripslashes($ArrayData);
}
elseif(strpos($ArrayData,'array') === 0 && strpos($ArrayData,"\' => \'") !== false)
{
$ArrayData = stripslashes($ArrayData);
}
$ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. .
@ -516,10 +520,11 @@ class e_array {
echo "<pre>";
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
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();
@ -533,6 +538,12 @@ class e_array {
if (!isset($data) || !is_array($data))
{
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;
}