|
@@ 5176-5192 (lines=17) @@
|
| 5173 |
|
* @param mixed $value |
| 5174 |
|
* @return string |
| 5175 |
|
*/ |
| 5176 |
|
function safe_serialize($value) |
| 5177 |
|
{ |
| 5178 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5179 |
|
if (function_exists('mb_internal_encoding') && |
| 5180 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5181 |
|
{ |
| 5182 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5183 |
|
mb_internal_encoding('ASCII'); |
| 5184 |
|
} |
| 5185 |
|
|
| 5186 |
|
$out = _safe_serialize($value); |
| 5187 |
|
|
| 5188 |
|
if (isset($mbIntEnc)) |
| 5189 |
|
mb_internal_encoding($mbIntEnc); |
| 5190 |
|
|
| 5191 |
|
return $out; |
| 5192 |
|
} |
| 5193 |
|
|
| 5194 |
|
/** |
| 5195 |
|
* Safe unserialize() replacement |
|
@@ 5353-5369 (lines=17) @@
|
| 5350 |
|
* @param string $str |
| 5351 |
|
* @return mixed |
| 5352 |
|
*/ |
| 5353 |
|
function safe_unserialize($str) |
| 5354 |
|
{ |
| 5355 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5356 |
|
if (function_exists('mb_internal_encoding') && |
| 5357 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5358 |
|
{ |
| 5359 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5360 |
|
mb_internal_encoding('ASCII'); |
| 5361 |
|
} |
| 5362 |
|
|
| 5363 |
|
$out = _safe_unserialize($str); |
| 5364 |
|
|
| 5365 |
|
if (isset($mbIntEnc)) |
| 5366 |
|
mb_internal_encoding($mbIntEnc); |
| 5367 |
|
|
| 5368 |
|
return $out; |
| 5369 |
|
} |
| 5370 |
|
|
| 5371 |
|
/** |
| 5372 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |