Hello,
does anyone know why all my sub-albums have this warning above the title: "Warning: sprintf(): Too few arguments in /web/htdocs/.../modules/core/classes/GalleryTranslator.class on line 552" ?
What does it mean? Is there a way to fix it?
This is the part of code it refers to:
Quote:
$i = 1;
$args = array();
while (isset($data['arg' . $i])) {
$args[] = $data['arg' . $i];
$i++;
/* Catch runaways */
if ($i > 100) {
return array(GalleryCoreApi::error(ERROR_UNKNOWN, __FILE__, __LINE__), null);
}
}
/*
* If we have arguments, then feed the localized string and the
* arguments into sprintf.
*/
if (sizeof($args) > 0) {
array_unshift($args, $localized);
$localized = call_user_func_array('sprintf', $args);
}
Does anyone understand it?
Versione di Gallery = 2.1.1 core 1.1.0.1
Versione PHP = 4.4.1 cgi
Webserver = Apache/2.0
Database = mysql 5.0.24-standard-log, lock.system=flock
Strumenti = ArchiveUpload, Exif, Getid3, Thumbnail, Gd, ImageMagick
Accelerazione = none, none
Sistema operativo = Linux webx53.aruba.it 2.6.9-42.0.2.ELsmp #1 SMP Wed Aug 23 00:17:26 CDT 2006 i686
Tema predefinito = PGtheme
Locale = it_IT
Browser = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Posts: 32509
no idea why you get this. maybe it has to do with the PGTheme.
do you get the same error when using the matrix theme?
related code has been changed since g2.1.1.
maybe you should try the latest nightly snapshot of g2.
Posts: 121
Thanks, Valiant. I don't have this problem if I switch to the classic theme (and probably any other theme), but I like the PGtheme for a number of reasons and I'd like to keep it if I can.
Is there a way to simply avoid the warning from appearing? It would do the trick anyway, since everything works fine even if there are "too few arguments in /web/htdocs etc...."
Posts: 32509
this points to a bug in the pgtheme then.
i'd add a conditional debug_backtrace call in GalleryTranslator to find out where the offending string came from.
or just print out the string and search it in the pgtheme dir.
Posts: 121
Valiant, I don't understand how to do that (sorry...). The offending string is this one:
if (sizeof($args) > 0) {
array_unshift($args, $localized);
$localized = call_user_func_array('sprintf', $args);
}
If I comment out the array_unshift($args, $localized); it works fine but it won't print the text such as "Number of visits", "Objects" and so on.
BTW, the same problem appears if I link an album from elsewhere (still within my site, I mean).
Posts: 121
Does anyone know how to "add a conditional debug_backtrace call in GalleryTranslator" as Valiant suggested? I searched various websites but they're too technical and the authors take for granted that you know what they're talking about...
I don't!
I feel it shouldn't be too hard to come up with a fix for this, but I don't know where to start.
Posts: 32509
topic moved to 3rd party module support.
please add
var_dump(debug_backtrace());
before the line
$localized = call_user_func_array('sprintf', $args);
and then enable immediate or logged debug mode
FAQ: How to set/use Gallery in debug mode?
Posts: 121
OK, nevermind. I managed to edit the Matrix theme with the elements I liked in the PGtheme. So, problem solved, I use my edited version of Matrix.