diff options
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/it_url.class b/it_url.class index 7bcf22d..ba194e7 100644 --- a/it_url.class +++ b/it_url.class @@ -581,7 +581,7 @@ static function get_cache_filename($p) * @param $p['it_error'] parameters for it::error(), false means ignore errors, anything else gets passed to it::error() if errors occur * @param $p['keepfailed'] keep old versions of files if download fails (sending alerts conservatively) * @param $p['returnheaders'] Return array($path, $headers) instead of simply $path - * @param $p['postprocess'] NOT SUPPORTED, use ::get_cache_contents + * @param $p['postprocess'] UNSUPPORTED, use ::get_cache_contents * @param $p['lock'] prevent multiple requests to same url from different processes [true] * @return Cache filename or false if fetch failed */ @@ -616,7 +616,7 @@ static function get_cache($p = array()) if ($data = $url->_get($p + ['checkonly' => true, 'filemtime' => EDC('nocache') ? null : $filemtime])) # => true means not modified (no new data fetched) { $success = true; - $isnewfile = it_url::_atomicwrite($path, $p['assoc'] ? serialize($data) : $data); + $isnewfile = it_url::_atomicwrite($path, $p['assoc'] ? it::json_encode($data) : $data); if ($p['returnheaders']) it::file_put("$path.json", it::json_encode($url->headers)); } @@ -719,7 +719,7 @@ static function get_cache_contents($p) $result = it::file_get_contents($fn); if ($p['assoc']) { - $response = unserialize($result); + $response = it::match('^\{', $result) ? it::json_decode($result, 'assoc' => true) : unserialize($result); # FIXME 2023-05 UM remove legacy support $response['data'] = self::_postprocess($response['data'], $p); $result = $response; } |