mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
make cache (get/set) binary safe
This commit is contained in:
parent
5e2464ed38
commit
9c27f4f77c
@ -62,10 +62,17 @@ class PEAR_Remote extends PEAR
|
||||
if (!file_exists($filename)) {
|
||||
return null;
|
||||
};
|
||||
|
||||
$fp = fopen($filename, "rb");
|
||||
if ($fp === null) {
|
||||
return null;
|
||||
}
|
||||
$content = fread($fp, filesize($filename));
|
||||
fclose($fp);
|
||||
$result = array(
|
||||
'age' => time() - filemtime($filename),
|
||||
'lastChange' => filemtime($filename),
|
||||
'content' => unserialize(implode('', file($filename))),
|
||||
'content' => unserialize($content),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@ -83,7 +90,7 @@ class PEAR_Remote extends PEAR
|
||||
}
|
||||
$filename = $cachedir.'/xmlrpc_cache_'.$id;
|
||||
|
||||
$fp = @fopen($filename, "w");
|
||||
$fp = @fopen($filename, "wb");
|
||||
if ($fp !== null) {
|
||||
fwrite($fp, serialize($data));
|
||||
fclose($fp);
|
||||
|
Loading…
Reference in New Issue
Block a user