cvs: php4 /pear/PEAR Remote.php
| From: | Christian Dickmann | Date: | Mon, 11 Nov 2002 01:23:24 +0000 |
| Subject: | cvs: php4 /pear/PEAR Remote.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-7353@lists.php.net to get a copy of this message | ||
dickmann Sun Nov 10 20:23:24 2002 EDT
Modified files:
/php4/pear/PEAR Remote.php
Log:
make cache (get/set) binary safe
Index: php4/pear/PEAR/Remote.php
diff -u php4/pear/PEAR/Remote.php:1.33 php4/pear/PEAR/Remote.php:1.34
--- php4/pear/PEAR/Remote.php:1.33 Sat Nov 9 21:44:49 2002
+++ php4/pear/PEAR/Remote.php Sun Nov 10 20:23:24 2002
@@ -16,7 +16,7 @@
// | Author: Stig Bakken <ssb@fast.no> |
// +----------------------------------------------------------------------+
//
-// $Id: Remote.php,v 1.33 2002/11/10 02:44:49 ssb Exp $
+// $Id: Remote.php,v 1.34 2002/11/11 01:23:24 dickmann Exp $
require_once 'PEAR.php';
require_once 'PEAR/Config.php';
@@ -62,10 +62,17 @@
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 @@
}
$filename = $cachedir.'/xmlrpc_cache_'.$id;
- $fp = @fopen($filename, "w");
+ $fp = @fopen($filename, "wb");
if ($fp !== null) {
fwrite($fp, serialize($data));
fclose($fp);