Posted by reikiman on April 17, 2009 at 1:32am
5 followers
Jump to:
| Project: | Cache Router |
| Version: | 6.x-1.0-beta8 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
I switched to the 'file' engine and got this error:-
warning: fopen() expects parameter 1 to be string, object given in /home/.nurse/reikiman/davidherron.com/sites/all/modules/cacherouter/engines/file.php on line 113.Workaround to get the message to shut up is:
[tang]$ hg diff
diff -r 72149220f6fb sites/all/modules/cacherouter/engines/file.php
--- a/sites/all/modules/cacherouter/engines/file.php Thu Apr 16 18:03:14 2009 -0700
+++ b/sites/all/modules/cacherouter/engines/file.php Thu Apr 16 18:24:23 2009 -0700
@@ -110,7 +110,7 @@
// Filename: abcdef12345verylongmd5code--content:123456:987654
$files = file_scan_directory($fspath, ".--$look_for[0].", array('.', '..', 'CVS'));
foreach ($files as $file) {
- if ($fp = fopen($file, 'w')) {
+ if (is_string($file) && $fp = fopen($file, 'w')) {
// only delete the cache file once we obtain an exclusive lock to prevent
// deleting a cache file that is currently being read.
if (flock($fp, LOCK_EX)) {
Comments
#1
Setting to needs review to flag to maintainer. =)
#2
Tried this. Can confirm t works for me, but I notice the same code exists at line 124. Should your replacement be used there as well? Please take a look.
#3
Seems logical - it's operating on the same variable. I implemented that with no problems so far, but hey, that's me.
#4
I really need to fix this one. Marking as duplicate of #352953: fileCache::delete() passes in wrong argument type for fopen() and unlink()
#5
I have tested this and it works.