Donate Share

phpThumb()

Tracker: Bugs

5 Errors generated when configured to not cull cache - ID: 1969547
Last Update: Comment added ( nextline )

I am encountering some errors when I try to use phpThumb() and configure it
to not use any cache culling.

Specifically, I see this: (trying to just paste this in SF, will probably
turn out pretty bad)

Notice: Undefined variable: DeletedKeys in
/data/oi/htdocs/finntemplates/phpThumb-1.7.8/phpthumb.class.php on line
752

Warning: Invalid argument supplied for foreach() in
/data/oi/htdocs/finntemplates/phpThumb-1.7.8/phpthumb.class.php on line
752

Notice: Undefined variable: AllFilesInCacheDirectory in
/data/oi/htdocs/finntemplates/phpThumb-1.7.8/phpthumb.class.php on line
755
**Headers already sent in file
"/data/oi/htdocs/finntemplates/phpThumb-1.7.8/phpthumb.class.php" on line
"752", dumping error message as text:**

phpThumb() v1.7.8-200709161750

Headers already sent (phpThumb.php line 446)


--

Steps to reproduce:
1. Install latest phpThumb() (1.7.8-200709161750).

2. Configure off any cache culling
Set cache_[maxage|maxsize|maxfiles] to null

3. Try to use phpThumb()
For me it works on the second try, so image is generated. However, first
request only results in error.

4. ???

5. Profit!


Nextline ( nextline ) - 2008-05-22 12:33

5

Open

None

Nobody/Anonymous

None

None

Public


Comments ( 2 )

Date: 2008-05-22 12:50
Sender: nextline


SF totally wrangled my text, as was expected.
The patch is of course completely trivial, but just so I do this the right
way, here is the patch attached as a seperate file.
File Added: phpthumb-no-cull-error.diff


Date: 2008-05-22 12:46
Sender: nextline


Seems to fix is to just return from the function a couple of lines before
the errors starts.
When you configure phpThumb() to not cull the cache, it logs a message to
that effect, then tries to do some statistics, and then it tries to remove
empty cache dirs.

The actions following the the logging statement do not make sense at that
point, so my guess is to just return the function after the logging
statement.
Included is a very simple patch that does just that.

--- phpthumb.class.php.org 2008-05-22 14:35:19.000000000 +0200
+++ phpthumb.class.php 2008-05-22 14:43:00.000000000 +0200
@@ -747,6 +747,7 @@

} else {
$this->DebugMessage('skipping
CleanUpCacheDirectory() because config set to not use it', __FILE__,
__LINE__);
+ return true;
}
$totalpurged = 0;
foreach ($DeletedKeys as $key => $value) {
@@ -3845,4 +3846,4 @@

}

-?>
\ No newline at end of file
+?>




Attached Files ( 2 )

Filename Description Download
phpthumb-error.png Error message from phpThumb Download
phpthumb-no-cull-error.diff Patch to remedy this bug Download

Changes ( 2 )

Field Old Value Date By
File Added 278662: phpthumb-no-cull-error.diff 2008-05-22 12:50 nextline
File Added 278660: phpthumb-error.png 2008-05-22 12:33 nextline