Recent Topics

1 Nov 02, 2011 11:56    

My b2evolution Version: 4.0.5

I don't like error logs that grow and grow at an alarming rate.

This one created in the root directory for b2evo is growing far too fast.

Having taken a peek inside it seems to be filling up with lots of:

(Warning) getimagesize(/../blogs/media/blogs/photos/foundations/_evocache/day16f.jpg/fit-80x80.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory

The file an directory are there but the routine is not retrying to find it on stream failure?

and many hundreds of:

(Notice) unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 0 of 1 bytes

Ah! the good old error in php when you try to unserialize something that is not serialized.

I'm getting about a dozen of these on every visitor page load.

Is there any way to eliminate them?

2 Nov 02, 2011 15:18

Any info about php file and line number where these errors appear?

3 Nov 02, 2011 15:50

The @unserialize($..) Notices occur in
/.../blogs/inc/settings/model/_abstractsettings.class.php:at line 295 or 315

There is no reliable way to test if the contents is a serialized string other than to generate an error if it isn't and the '@' ignore error has no effect. So the test used on first pass to bring the unserialized value into the cache will always generate an error.
The comment in the file is
// Try to unserialize setting (once) - this is as fast as checking an array of values that should get unserialized

It may well be as fast but if it is then surely the route of least errors should be chosen?

The (Warning) getimagesize(... occur in
/.../blogs/inc/files/model/_file.funcs.php:at line 319

I think this is failing because the file is temporarily being seen as unobtainable. Looking through the entries they all seem to refer to _evocache subfolder

NB line numbers are not much guidance for you as these files have been reformatted to corp style by the PHP editor. - I opened them to try to trace the source of the error.

4 Nov 02, 2011 19:17

error #1
You may need to edit your error handler
http://www.php.net/manual/en/language.operators.errorcontrol.php#98895

error #2
This should fix it

	if( isset($cache_imgsize[$path]) )
	{
		$size = $cache_imgsize[$path];
	}
	elseif( !file_exists($path) || !($size = @getimagesize( $path )) )
	{	// File not found, or not an image
		return false;
	}
	else
	{
		$cache_imgsize[$path] = $size;
	}

5 Nov 03, 2011 10:37

Many thanks once again for your help with this.

Both of your solutions appear to work fine.

The error log is now much cleaner.

That second fix of checking the file exists before retrieving the size seems as if it should be included in the main version - especially as there is a risk of overwriting this deep file on upgrade?


Form is loading...