@@ 5637-5653 (lines=17) @@ | ||
5634 | * @param mixed $value |
|
5635 | * @return string |
|
5636 | */ |
|
5637 | function safe_serialize($value) |
|
5638 | { |
|
5639 | // Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
|
5640 | if (function_exists('mb_internal_encoding') && |
|
5641 | (((int) ini_get('mbstring.func_overload')) & 2)) |
|
5642 | { |
|
5643 | $mbIntEnc = mb_internal_encoding(); |
|
5644 | mb_internal_encoding('ASCII'); |
|
5645 | } |
|
5646 | ||
5647 | $out = _safe_serialize($value); |
|
5648 | ||
5649 | if (isset($mbIntEnc)) |
|
5650 | mb_internal_encoding($mbIntEnc); |
|
5651 | ||
5652 | return $out; |
|
5653 | } |
|
5654 | ||
5655 | /** |
|
5656 | * Safe unserialize() replacement |
|
@@ 5814-5830 (lines=17) @@ | ||
5811 | * @param string $str |
|
5812 | * @return mixed |
|
5813 | */ |
|
5814 | function safe_unserialize($str) |
|
5815 | { |
|
5816 | // Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen() |
|
5817 | if (function_exists('mb_internal_encoding') && |
|
5818 | (((int) ini_get('mbstring.func_overload')) & 0x02)) |
|
5819 | { |
|
5820 | $mbIntEnc = mb_internal_encoding(); |
|
5821 | mb_internal_encoding('ASCII'); |
|
5822 | } |
|
5823 | ||
5824 | $out = _safe_unserialize($str); |
|
5825 | ||
5826 | if (isset($mbIntEnc)) |
|
5827 | mb_internal_encoding($mbIntEnc); |
|
5828 | ||
5829 | return $out; |
|
5830 | } |
|
5831 | ||
5832 | /** |
|
5833 | * Tries different modes to make file/dirs writable. Wrapper function for chmod() |