|
@@ 5301-5317 (lines=17) @@
|
| 5298 |
|
* @param mixed $value |
| 5299 |
|
* @return string |
| 5300 |
|
*/ |
| 5301 |
|
function safe_serialize($value) |
| 5302 |
|
{ |
| 5303 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5304 |
|
if (function_exists('mb_internal_encoding') && |
| 5305 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5306 |
|
{ |
| 5307 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5308 |
|
mb_internal_encoding('ASCII'); |
| 5309 |
|
} |
| 5310 |
|
|
| 5311 |
|
$out = _safe_serialize($value); |
| 5312 |
|
|
| 5313 |
|
if (isset($mbIntEnc)) |
| 5314 |
|
mb_internal_encoding($mbIntEnc); |
| 5315 |
|
|
| 5316 |
|
return $out; |
| 5317 |
|
} |
| 5318 |
|
|
| 5319 |
|
/** |
| 5320 |
|
* Safe unserialize() replacement |
|
@@ 5478-5494 (lines=17) @@
|
| 5475 |
|
* @param string $str |
| 5476 |
|
* @return mixed |
| 5477 |
|
*/ |
| 5478 |
|
function safe_unserialize($str) |
| 5479 |
|
{ |
| 5480 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5481 |
|
if (function_exists('mb_internal_encoding') && |
| 5482 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5483 |
|
{ |
| 5484 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5485 |
|
mb_internal_encoding('ASCII'); |
| 5486 |
|
} |
| 5487 |
|
|
| 5488 |
|
$out = _safe_unserialize($str); |
| 5489 |
|
|
| 5490 |
|
if (isset($mbIntEnc)) |
| 5491 |
|
mb_internal_encoding($mbIntEnc); |
| 5492 |
|
|
| 5493 |
|
return $out; |
| 5494 |
|
} |
| 5495 |
|
|
| 5496 |
|
/** |
| 5497 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |