|
@@ 5281-5297 (lines=17) @@
|
| 5278 |
|
* @param mixed $value |
| 5279 |
|
* @return string |
| 5280 |
|
*/ |
| 5281 |
|
function safe_serialize($value) |
| 5282 |
|
{ |
| 5283 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5284 |
|
if (function_exists('mb_internal_encoding') && |
| 5285 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5286 |
|
{ |
| 5287 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5288 |
|
mb_internal_encoding('ASCII'); |
| 5289 |
|
} |
| 5290 |
|
|
| 5291 |
|
$out = _safe_serialize($value); |
| 5292 |
|
|
| 5293 |
|
if (isset($mbIntEnc)) |
| 5294 |
|
mb_internal_encoding($mbIntEnc); |
| 5295 |
|
|
| 5296 |
|
return $out; |
| 5297 |
|
} |
| 5298 |
|
|
| 5299 |
|
/** |
| 5300 |
|
* Safe unserialize() replacement |
|
@@ 5458-5474 (lines=17) @@
|
| 5455 |
|
* @param string $str |
| 5456 |
|
* @return mixed |
| 5457 |
|
*/ |
| 5458 |
|
function safe_unserialize($str) |
| 5459 |
|
{ |
| 5460 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5461 |
|
if (function_exists('mb_internal_encoding') && |
| 5462 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5463 |
|
{ |
| 5464 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5465 |
|
mb_internal_encoding('ASCII'); |
| 5466 |
|
} |
| 5467 |
|
|
| 5468 |
|
$out = _safe_unserialize($str); |
| 5469 |
|
|
| 5470 |
|
if (isset($mbIntEnc)) |
| 5471 |
|
mb_internal_encoding($mbIntEnc); |
| 5472 |
|
|
| 5473 |
|
return $out; |
| 5474 |
|
} |
| 5475 |
|
|
| 5476 |
|
/** |
| 5477 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |