|
@@ 5343-5359 (lines=17) @@
|
| 5340 |
|
* @param mixed $value |
| 5341 |
|
* @return string |
| 5342 |
|
*/ |
| 5343 |
|
function safe_serialize($value) |
| 5344 |
|
{ |
| 5345 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5346 |
|
if (function_exists('mb_internal_encoding') && |
| 5347 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5348 |
|
{ |
| 5349 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5350 |
|
mb_internal_encoding('ASCII'); |
| 5351 |
|
} |
| 5352 |
|
|
| 5353 |
|
$out = _safe_serialize($value); |
| 5354 |
|
|
| 5355 |
|
if (isset($mbIntEnc)) |
| 5356 |
|
mb_internal_encoding($mbIntEnc); |
| 5357 |
|
|
| 5358 |
|
return $out; |
| 5359 |
|
} |
| 5360 |
|
|
| 5361 |
|
/** |
| 5362 |
|
* Safe unserialize() replacement |
|
@@ 5520-5536 (lines=17) @@
|
| 5517 |
|
* @param string $str |
| 5518 |
|
* @return mixed |
| 5519 |
|
*/ |
| 5520 |
|
function safe_unserialize($str) |
| 5521 |
|
{ |
| 5522 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5523 |
|
if (function_exists('mb_internal_encoding') && |
| 5524 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5525 |
|
{ |
| 5526 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5527 |
|
mb_internal_encoding('ASCII'); |
| 5528 |
|
} |
| 5529 |
|
|
| 5530 |
|
$out = _safe_unserialize($str); |
| 5531 |
|
|
| 5532 |
|
if (isset($mbIntEnc)) |
| 5533 |
|
mb_internal_encoding($mbIntEnc); |
| 5534 |
|
|
| 5535 |
|
return $out; |
| 5536 |
|
} |
| 5537 |
|
|
| 5538 |
|
/** |
| 5539 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |