|
@@ 5334-5350 (lines=17) @@
|
| 5331 |
|
* @param mixed $value |
| 5332 |
|
* @return string |
| 5333 |
|
*/ |
| 5334 |
|
function safe_serialize($value) |
| 5335 |
|
{ |
| 5336 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5337 |
|
if (function_exists('mb_internal_encoding') && |
| 5338 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5339 |
|
{ |
| 5340 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5341 |
|
mb_internal_encoding('ASCII'); |
| 5342 |
|
} |
| 5343 |
|
|
| 5344 |
|
$out = _safe_serialize($value); |
| 5345 |
|
|
| 5346 |
|
if (isset($mbIntEnc)) |
| 5347 |
|
mb_internal_encoding($mbIntEnc); |
| 5348 |
|
|
| 5349 |
|
return $out; |
| 5350 |
|
} |
| 5351 |
|
|
| 5352 |
|
/** |
| 5353 |
|
* Safe unserialize() replacement |
|
@@ 5511-5527 (lines=17) @@
|
| 5508 |
|
* @param string $str |
| 5509 |
|
* @return mixed |
| 5510 |
|
*/ |
| 5511 |
|
function safe_unserialize($str) |
| 5512 |
|
{ |
| 5513 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5514 |
|
if (function_exists('mb_internal_encoding') && |
| 5515 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5516 |
|
{ |
| 5517 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5518 |
|
mb_internal_encoding('ASCII'); |
| 5519 |
|
} |
| 5520 |
|
|
| 5521 |
|
$out = _safe_unserialize($str); |
| 5522 |
|
|
| 5523 |
|
if (isset($mbIntEnc)) |
| 5524 |
|
mb_internal_encoding($mbIntEnc); |
| 5525 |
|
|
| 5526 |
|
return $out; |
| 5527 |
|
} |
| 5528 |
|
|
| 5529 |
|
/** |
| 5530 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |