|
@@ 5219-5235 (lines=17) @@
|
| 5216 |
|
* @param mixed $value |
| 5217 |
|
* @return string |
| 5218 |
|
*/ |
| 5219 |
|
function safe_serialize($value) |
| 5220 |
|
{ |
| 5221 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5222 |
|
if (function_exists('mb_internal_encoding') && |
| 5223 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5224 |
|
{ |
| 5225 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5226 |
|
mb_internal_encoding('ASCII'); |
| 5227 |
|
} |
| 5228 |
|
|
| 5229 |
|
$out = _safe_serialize($value); |
| 5230 |
|
|
| 5231 |
|
if (isset($mbIntEnc)) |
| 5232 |
|
mb_internal_encoding($mbIntEnc); |
| 5233 |
|
|
| 5234 |
|
return $out; |
| 5235 |
|
} |
| 5236 |
|
|
| 5237 |
|
/** |
| 5238 |
|
* Safe unserialize() replacement |
|
@@ 5396-5412 (lines=17) @@
|
| 5393 |
|
* @param string $str |
| 5394 |
|
* @return mixed |
| 5395 |
|
*/ |
| 5396 |
|
function safe_unserialize($str) |
| 5397 |
|
{ |
| 5398 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5399 |
|
if (function_exists('mb_internal_encoding') && |
| 5400 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5401 |
|
{ |
| 5402 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5403 |
|
mb_internal_encoding('ASCII'); |
| 5404 |
|
} |
| 5405 |
|
|
| 5406 |
|
$out = _safe_unserialize($str); |
| 5407 |
|
|
| 5408 |
|
if (isset($mbIntEnc)) |
| 5409 |
|
mb_internal_encoding($mbIntEnc); |
| 5410 |
|
|
| 5411 |
|
return $out; |
| 5412 |
|
} |
| 5413 |
|
|
| 5414 |
|
/** |
| 5415 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |