|
@@ 5147-5163 (lines=17) @@
|
| 5144 |
|
* @param mixed $value |
| 5145 |
|
* @return string |
| 5146 |
|
*/ |
| 5147 |
|
function safe_serialize($value) |
| 5148 |
|
{ |
| 5149 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5150 |
|
if (function_exists('mb_internal_encoding') && |
| 5151 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5152 |
|
{ |
| 5153 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5154 |
|
mb_internal_encoding('ASCII'); |
| 5155 |
|
} |
| 5156 |
|
|
| 5157 |
|
$out = _safe_serialize($value); |
| 5158 |
|
|
| 5159 |
|
if (isset($mbIntEnc)) |
| 5160 |
|
mb_internal_encoding($mbIntEnc); |
| 5161 |
|
|
| 5162 |
|
return $out; |
| 5163 |
|
} |
| 5164 |
|
|
| 5165 |
|
/** |
| 5166 |
|
* Safe unserialize() replacement |
|
@@ 5324-5340 (lines=17) @@
|
| 5321 |
|
* @param string $str |
| 5322 |
|
* @return mixed |
| 5323 |
|
*/ |
| 5324 |
|
function safe_unserialize($str) |
| 5325 |
|
{ |
| 5326 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5327 |
|
if (function_exists('mb_internal_encoding') && |
| 5328 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5329 |
|
{ |
| 5330 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5331 |
|
mb_internal_encoding('ASCII'); |
| 5332 |
|
} |
| 5333 |
|
|
| 5334 |
|
$out = _safe_unserialize($str); |
| 5335 |
|
|
| 5336 |
|
if (isset($mbIntEnc)) |
| 5337 |
|
mb_internal_encoding($mbIntEnc); |
| 5338 |
|
|
| 5339 |
|
return $out; |
| 5340 |
|
} |
| 5341 |
|
|
| 5342 |
|
/** |
| 5343 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |