summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dickmann <dickmann@php.net>2002-11-11 01:23:24 +0000
committerChristian Dickmann <dickmann@php.net>2002-11-11 01:23:24 +0000
commit9c27f4f77cc45e6fcf61a4755b4ce4b2506fe8a0 (patch)
tree6ed89ae8024452ca257c58cfdbd31732d13f8d6f
parent5e2464ed38641f5579dd4da60a6efbd9cf01a5cb (diff)
downloadphp-git-9c27f4f77cc45e6fcf61a4755b4ce4b2506fe8a0.tar.gz
make cache (get/set) binary safe
-rw-r--r--pear/PEAR/Remote.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/pear/PEAR/Remote.php b/pear/PEAR/Remote.php
index 5662e9de01..0d1a11556c 100644
--- a/pear/PEAR/Remote.php
+++ b/pear/PEAR/Remote.php
@@ -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);