|
@@ 4996-5012 (lines=17) @@
|
| 4993 |
|
* @param mixed $value |
| 4994 |
|
* @return string |
| 4995 |
|
*/ |
| 4996 |
|
function safe_serialize($value) |
| 4997 |
|
{ |
| 4998 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 4999 |
|
if (function_exists('mb_internal_encoding') && |
| 5000 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5001 |
|
{ |
| 5002 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5003 |
|
mb_internal_encoding('ASCII'); |
| 5004 |
|
} |
| 5005 |
|
|
| 5006 |
|
$out = _safe_serialize($value); |
| 5007 |
|
|
| 5008 |
|
if (isset($mbIntEnc)) |
| 5009 |
|
mb_internal_encoding($mbIntEnc); |
| 5010 |
|
|
| 5011 |
|
return $out; |
| 5012 |
|
} |
| 5013 |
|
|
| 5014 |
|
/** |
| 5015 |
|
* Safe unserialize() replacement |
|
@@ 5189-5205 (lines=17) @@
|
| 5186 |
|
* @param string $str |
| 5187 |
|
* @return mixed |
| 5188 |
|
*/ |
| 5189 |
|
function safe_unserialize($str) |
| 5190 |
|
{ |
| 5191 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5192 |
|
if (function_exists('mb_internal_encoding') && |
| 5193 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5194 |
|
{ |
| 5195 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5196 |
|
mb_internal_encoding('ASCII'); |
| 5197 |
|
} |
| 5198 |
|
|
| 5199 |
|
$out = _safe_unserialize($str); |
| 5200 |
|
|
| 5201 |
|
if (isset($mbIntEnc)) |
| 5202 |
|
mb_internal_encoding($mbIntEnc); |
| 5203 |
|
|
| 5204 |
|
return $out; |
| 5205 |
|
} |
| 5206 |
|
|
| 5207 |
|
/** |
| 5208 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |