|
@@ 5098-5114 (lines=17) @@
|
| 5095 |
|
* @param mixed $value |
| 5096 |
|
* @return string |
| 5097 |
|
*/ |
| 5098 |
|
function safe_serialize($value) |
| 5099 |
|
{ |
| 5100 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5101 |
|
if (function_exists('mb_internal_encoding') && |
| 5102 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5103 |
|
{ |
| 5104 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5105 |
|
mb_internal_encoding('ASCII'); |
| 5106 |
|
} |
| 5107 |
|
|
| 5108 |
|
$out = _safe_serialize($value); |
| 5109 |
|
|
| 5110 |
|
if (isset($mbIntEnc)) |
| 5111 |
|
mb_internal_encoding($mbIntEnc); |
| 5112 |
|
|
| 5113 |
|
return $out; |
| 5114 |
|
} |
| 5115 |
|
|
| 5116 |
|
/** |
| 5117 |
|
* Safe unserialize() replacement |
|
@@ 5275-5291 (lines=17) @@
|
| 5272 |
|
* @param string $str |
| 5273 |
|
* @return mixed |
| 5274 |
|
*/ |
| 5275 |
|
function safe_unserialize($str) |
| 5276 |
|
{ |
| 5277 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5278 |
|
if (function_exists('mb_internal_encoding') && |
| 5279 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5280 |
|
{ |
| 5281 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5282 |
|
mb_internal_encoding('ASCII'); |
| 5283 |
|
} |
| 5284 |
|
|
| 5285 |
|
$out = _safe_unserialize($str); |
| 5286 |
|
|
| 5287 |
|
if (isset($mbIntEnc)) |
| 5288 |
|
mb_internal_encoding($mbIntEnc); |
| 5289 |
|
|
| 5290 |
|
return $out; |
| 5291 |
|
} |
| 5292 |
|
|
| 5293 |
|
/** |
| 5294 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |