/** * Unserializes data using PHP's `unserialize()`, and its safety options if possible. * This function should only be used for values from trusted sources. * * @param string $str * @return mixed */ function native_unserialize($str) { if(version_compare(PHP_VERSION, '7.0.0', '>=')) { return unserialize($str, array('allowed_classes' => false)); } else { return unserialize($str); }