Skip to content

Commit

Permalink
add support for explicit unserialize options + retrive Object as orig…
Browse files Browse the repository at this point in the history
…inal instead of __PHP_Incomplete_Class
  • Loading branch information
netcode committed Apr 1, 2017
1 parent 6c64759 commit b5de04b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Normalizers/NormalizeSerialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function run()
if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
//options added @ v 7.0 which allow no evaluating for classes
//object will be instantiated as __PHP_Incomplete_Class
$decoded = @unserialize($this->value, false);
$decoded = @unserialize($this->value, []);
} else {
$decoded = false; //don't serialize it might be danger
}
Expand All @@ -79,6 +79,12 @@ public function run()
$decoded = $arrayValue;
}

//Object of class __PHP_Incomplete_Class
if(gettype($decoded) === 'object'){
//object serialize must be the same
return $this->value;
}

return $decoded;
}
}

0 comments on commit b5de04b

Please sign in to comment.