|
@@ 5133-5149 (lines=17) @@
|
| 5130 |
|
* @param mixed $value |
| 5131 |
|
* @return string |
| 5132 |
|
*/ |
| 5133 |
|
function safe_serialize($value) |
| 5134 |
|
{ |
| 5135 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5136 |
|
if (function_exists('mb_internal_encoding') && |
| 5137 |
|
(((int) ini_get('mbstring.func_overload')) & 2)) |
| 5138 |
|
{ |
| 5139 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5140 |
|
mb_internal_encoding('ASCII'); |
| 5141 |
|
} |
| 5142 |
|
|
| 5143 |
|
$out = _safe_serialize($value); |
| 5144 |
|
|
| 5145 |
|
if (isset($mbIntEnc)) |
| 5146 |
|
mb_internal_encoding($mbIntEnc); |
| 5147 |
|
|
| 5148 |
|
return $out; |
| 5149 |
|
} |
| 5150 |
|
|
| 5151 |
|
/** |
| 5152 |
|
* Safe unserialize() replacement |
|
@@ 5310-5326 (lines=17) @@
|
| 5307 |
|
* @param string $str |
| 5308 |
|
* @return mixed |
| 5309 |
|
*/ |
| 5310 |
|
function safe_unserialize($str) |
| 5311 |
|
{ |
| 5312 |
|
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
| 5313 |
|
if (function_exists('mb_internal_encoding') && |
| 5314 |
|
(((int) ini_get('mbstring.func_overload')) & 0x02)) |
| 5315 |
|
{ |
| 5316 |
|
$mbIntEnc = mb_internal_encoding(); |
| 5317 |
|
mb_internal_encoding('ASCII'); |
| 5318 |
|
} |
| 5319 |
|
|
| 5320 |
|
$out = _safe_unserialize($str); |
| 5321 |
|
|
| 5322 |
|
if (isset($mbIntEnc)) |
| 5323 |
|
mb_internal_encoding($mbIntEnc); |
| 5324 |
|
|
| 5325 |
|
return $out; |
| 5326 |
|
} |
| 5327 |
|
|
| 5328 |
|
/** |
| 5329 |
|
* Tries different modes to make file/dirs writable. Wrapper function for chmod() |