PDA

View Full Version : Sudden sprintf error in EE 2.01


superchief
9th of April 2007 (Mon), 20:21
I have had EE 2.01 working fine for many months since it came out last year. Suddenly, I am now getting an error on the top of the page when viewing gallery pages. Here is the error (with Firefox 2.0.0.3):

Warning: sprintf() [function.sprintf (http://www.thechiefway.com/gallery/function.sprintf)]: Precision must be greater then zero and less then 2147483647. in /home/user/public_html/gallery/basecode/SCRIPT_slashwork.php on line 180

Perhaps I missed something, but I did not see this error mentioned anywhere. Does anybody have any ideas? I suspect something changed on the server.

Here is an example:

http://www.thechiefway.com/gallery/photo.php?photo=631&exhibition=14&ee_lang=eng

Thanks.

Pekka
17th of April 2007 (Tue), 11:54
I can't reproduce it, must be PHP version specific bug. Try this: replace the ee_FloatFormat function on SCRIPT_slashwork.php the with

if (!function_exists("ee_FloatFormat")) {
function ee_FloatFormat($Value, $Precision) {
// function from http://www.php.net/manual/en/function.printf.php
$decimals = log10(abs($Value));
$decimals = - (intval(min($decimals, 0)) - $Precision);
$format = "%." . $decimals . "f";
return @sprintf($format, abs($Value));
}
}

seanspeng
14th of May 2007 (Mon), 15:12
Thank you. That fixed problem. I also experienced the same when moving to a new host.