Hi,
I'm currently develping a custom theme for a mid-sized Drupal site (6.22) and ran into a bizarre problem: Suddenly all page titles are rendered with the exact same string, but not (never) with the actual page title. The string is the localized version of "Image galleries".
This behaviour affects as well nodes and taxonomy term pages as views, panel pages and even administrative pages, altogether around 50,000 pages. The string appears as well in the node title (<h1 class="title"> ... </h1), as in the browser's page title (<title> ... </title>), but *not* in the meta tags (<meta name="dc.title" content=" ... " />).
The theme is a custom sub-theme of Fusion, so I checked against the (unaltered) core theme 'Garland', and against the unaltered 'Fusion core' base the, which both show exactly the same behaviour; so this seems not to be an issue of my customized theme.
Also I checked the node table of the site's database which still has the correct node titles in the "title" colum. I am using the 'page_title' module, so I suspected an amok behaviour and disabled the module; this didn't change the malfunction, so 'page_title' is probably innocent. Additionally I created a block with Views and pulled the node respectively taxonomy term title via an argument into the block; these node respectively term titles *do* render correctly, so there seems to be no obvious issue with the database (which I checked as well with the command line utility 'mysqlcheck').
Of course I cleared the theme registry and all other caches multiple times (through 'admin_menu', and 'drush'). This had no effect as well.
I can edit the localized string at ./admin/build/translate/search (in my case it's /admin/build/translate/edit/31625), and after saving, it immediately renders throughout the whole site as "generic" page title. It's nice to know where the string comes from, but this doesn't help much; it is used by the 'image' module, and this module is clearly not designed for this kind of site-wide override. However, to make sure I disabled the modules 'image', 'image_attach', 'image_gallery', and 'image_import' and was most surprised to learn the the page titles went back to their normal states. Now I am really confused and still don't believe that 'image' module can be the root cause.
I am totally out of ideas what could cause this kind of behaviour; the 'page_title' module is the only module I am aware of that could globally alter the <title> tag, but I don't have the faintest idea what could modify the <h1 class="title"> tag across themes (which excludes theme overrides in *one* theme as the possible root cause).
Any ideas or suggestions what might actually go wrong here?
Thanks! -asb
Image module issue for this: #1254778
On Sat, Aug 20, 2011 at 05:31:54AM +0200, Agon S. Buchholz wrote:
Any ideas or suggestions what might actually go wrong here?
You seem to have done everything that can be done to spot the problem :-)
The drupal_set_title() [0] function is usually called to set the title of a page. The only place where I can see it being called among the Image family of modules is inside the image_gallery_page() [1] function of the image_gallery module. This function is actually a menu callback for the "image" path. So any path like "http://foo.com/image", "http://foo.com/image/foo/bar", etc. should trigger this function. But you are seeing the title everywhere. So it could be that some other function is calling image_gallery_page() as well. You can debug around both the drupal_set_title() and image_gallery_page() to see who is really calling them.
Thanks, Adnan
[0] http://api.drupal.org/api/drupal/includes--path.inc/function/drupal_set_titl... [1] http://drupalcode.org/project/image.git/blob/d900d7f90711c5f00b6d6b0a388559d...
On Sat, Aug 20, 2011 at 05:31:54AM +0200, Agon S. Buchholz wrote:
Hi,
I'm currently develping a custom theme for a mid-sized Drupal site (6.22) and ran into a bizarre problem: Suddenly all page titles are rendered with the exact same string, but not (never) with the actual page title. The string is the localized version of "Image galleries".
This behaviour affects as well nodes and taxonomy term pages as views, panel pages and even administrative pages, altogether around 50,000 pages. The string appears as well in the node title (<h1 class="title"> ... </h1), as in the browser's page title (<title> ... </title>), but *not* in the meta tags (<meta name="dc.title" content=" ... " />).
The theme is a custom sub-theme of Fusion, so I checked against the (unaltered) core theme 'Garland', and against the unaltered 'Fusion core' base the, which both show exactly the same behaviour; so this seems not to be an issue of my customized theme.
Also I checked the node table of the site's database which still has the correct node titles in the "title" colum. I am using the 'page_title' module, so I suspected an amok behaviour and disabled the module; this didn't change the malfunction, so 'page_title' is probably innocent. Additionally I created a block with Views and pulled the node respectively taxonomy term title via an argument into the block; these node respectively term titles *do* render correctly, so there seems to be no obvious issue with the database (which I checked as well with the command line utility 'mysqlcheck').
Of course I cleared the theme registry and all other caches multiple times (through 'admin_menu', and 'drush'). This had no effect as well.
I can edit the localized string at ./admin/build/translate/search (in my case it's /admin/build/translate/edit/31625), and after saving, it immediately renders throughout the whole site as "generic" page title. It's nice to know where the string comes from, but this doesn't help much; it is used by the 'image' module, and this module is clearly not designed for this kind of site-wide override. However, to make sure I disabled the modules 'image', 'image_attach', 'image_gallery', and 'image_import' and was most surprised to learn the the page titles went back to their normal states. Now I am really confused and still don't believe that 'image' module can be the root cause.
I am totally out of ideas what could cause this kind of behaviour; the 'page_title' module is the only module I am aware of that could globally alter the <title> tag, but I don't have the faintest idea what could modify the <h1 class="title"> tag across themes (which excludes theme overrides in *one* theme as the possible root cause).
Any ideas or suggestions what might actually go wrong here?
Thanks! -asb
Image module issue for this: #1254778
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Hi Adnan,
[...] This function is actually a menu callback for the "image" path. So any path like "http://foo.com/image", "http://foo.com/image/foo/bar", etc. should trigger this function. But you are seeing the title everywhere. So it could be that some other function is calling image_gallery_page() as well. You can debug around both the drupal_set_title() and image_gallery_page() to see who is really calling them.
Thanks for this pointer; drupal_set_title() might explain what is going on behind the scenes, indeed.
However, as it seems, this has nothing to do with the theming layer and would require serious debugging skills which are far beyond my capabilities, so there's not much I can do against it.
Thanks again for the pointer! At least I wasn't attacked by black magic ;)
Greetings, -asb
On Sat, Aug 20, 2011 at 03:41:24PM +0200, Agon S. Buchholz wrote:
However, as it seems, this has nothing to do with the theming layer and would require serious debugging skills which are far beyond my capabilities, so there's not much I can do against it.
I understand your problem. If you are not shy about writing some PHP code, then you can call the debug_backtrace() function [0] from inside drupal_set_title() to find out who is calling whom. Something like the following will do:
... drupal_set_title(....); drupal_set_message(print_r(debug_backtrace(), TRUE)); ...
Thanks, Adnan
[0] http://uk2.php.net/debug_backtrace
On Sat, Aug 20, 2011 at 03:41:24PM +0200, Agon S. Buchholz wrote:
Hi Adnan,
[...] This function is actually a menu callback for the "image" path. So any path like "http://foo.com/image", "http://foo.com/image/foo/bar", etc. should trigger this function. But you are seeing the title everywhere. So it could be that some other function is calling image_gallery_page() as well. You can debug around both the drupal_set_title() and image_gallery_page() to see who is really calling them.
Thanks for this pointer; drupal_set_title() might explain what is going on behind the scenes, indeed.
However, as it seems, this has nothing to do with the theming layer and would require serious debugging skills which are far beyond my capabilities, so there's not much I can do against it.
Thanks again for the pointer! At least I wasn't attacked by black magic ;)
Greetings, -asb _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Progga wrote:
If you are not shy about writing some PHP code, then you can call the debug_backtrace() function [0] from inside drupal_set_title() to find out who is calling whom.
Thanks again. I tried to put this into ./sites/all/modules/image/contrib/image_gallery/image_gallery.pages.inc:
... $breadcrumb[] = l($parent->name, 'image/tid/' . $parent->tid); } drupal_set_title(check_plain($gallery->name)); drupal_set_message(print_r(debug_backtrace(), TRUE)); } ...
However this didn't output anything but the normal page. What should I expect?
Greetings, -asb
On Sat, Aug 20, 2011 at 07:33:29PM +0200, Agon S. Buchholz wrote:
Thanks again. I tried to put this into ./sites/all/modules/image/contrib/image_gallery/image_gallery.pages.inc:
... $breadcrumb[] = l($parent->name, 'image/tid/' . $parent->tid); } drupal_set_title(check_plain($gallery->name)); drupal_set_message(print_r(debug_backtrace(), TRUE)); } ...
However this didn't output anything but the normal page. What should I expect?
The sequence of calling functions should be displayed as a normal Drupal message. You can see an example at http://uk2.php.net/debug_backtrace if you scroll down to the "Examples" section.
If no output is generated then it could be that the image_gallery_page() function is not called. Try calling "drupal_set_message(print_r(debug_backtrace(), TRUE))" from inside the drupal_set_title() function at "includes/path.inc, line 206".
Thanks, Adnan
On Sat, Aug 20, 2011 at 07:33:29PM +0200, Agon S. Buchholz wrote:
Progga wrote:
If you are not shy about writing some PHP code, then you can call the debug_backtrace() function [0] from inside drupal_set_title() to find out who is calling whom.
Thanks again. I tried to put this into ./sites/all/modules/image/contrib/image_gallery/image_gallery.pages.inc:
... $breadcrumb[] = l($parent->name, 'image/tid/' . $parent->tid); } drupal_set_title(check_plain($gallery->name)); drupal_set_message(print_r(debug_backtrace(), TRUE)); } ...
However this didn't output anything but the normal page. What should I expect?
Greetings, -asb
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Progga wrote:
Try calling "drupal_set_message(print_r(debug_backtrace(), TRUE))" from inside the drupal_set_title() function at "includes/path.inc, line 206".
Thanks for your patience, but I had no luck with this either.
function drupal_get_title() { $title = drupal_set_title(); drupal_set_message(print_r(debug_backtrace(), TRUE))
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
return $title; }
and
function drupal_get_title() { $title = drupal_set_title();
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); } drupal_set_message(print_r(debug_backtrace(), TRUE)) return $title; }
result in:
Parse error: syntax error, unexpected T_IF in /var/www/drupal/includes/path.inc on line 235
respctively
Parse error: syntax error, unexpected T_RETURN in /var/www/drupal/includes/path.inc on line 239
(is this even "inside the function"?)
function drupal_set_title($title = NULL) { drupal_set_message(print_r(debug_backtrace(), TRUE)) static $stored_title;
results in
Parse error: syntax error, unexpected T_STATIC in /var/www/drupal/includes/path.inc on line 253
function drupal_get_title() { $title = drupal_set_title(drupal_set_message(print_r(debug_backtrace(), TRUE)));
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
results in lots of debug output all over the first page I', loading, and then in
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 54190338 bytes) in /var/www/drupal/includes/theme.inc on line 1879
(current PHP memory limit: 200M)
Sorry, this is too much guesswork as I don't understand enough about PHP syntax.
E.g. "inside the function" drupal_set_title(check_plain($gallery->name)); probably means somewhere inside the first (), or second (), either before, or after "check_plain", or either before, or after "$gallery->name".
Greetings, -asb
Because print_r is a direct output function. You'd need some sort of buffering scheme to grab its output in chunks and assign it to a variable or put it in the database or whatever, once per usage.
On Sun, Aug 21, 2011 at 7:20 AM, Agon S. Buchholz asb@kefk.org wrote:
Progga wrote:
Try calling "drupal_set_message(print_r(debug_backtrace(), TRUE))" from inside the drupal_set_title() function at "includes/path.inc, line 206".
Thanks for your patience, but I had no luck with this either.
function drupal_get_title() { $title = drupal_set_title(); drupal_set_message(print_r(debug_backtrace(), TRUE))
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
return $title; }
and
function drupal_get_title() { $title = drupal_set_title();
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); } drupal_set_message(print_r(debug_backtrace(), TRUE)) return $title; }
result in:
Parse error: syntax error, unexpected T_IF in /var/www/drupal/includes/path.inc on line 235
respctively
Parse error: syntax error, unexpected T_RETURN in /var/www/drupal/includes/path.inc on line 239
(is this even "inside the function"?)
function drupal_set_title($title = NULL) { drupal_set_message(print_r(debug_backtrace(), TRUE)) static $stored_title;
results in
Parse error: syntax error, unexpected T_STATIC in /var/www/drupal/includes/path.inc on line 253
function drupal_get_title() { $title = drupal_set_title(drupal_set_message(print_r(debug_backtrace(), TRUE)));
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
results in lots of debug output all over the first page I', loading, and then in
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 54190338 bytes) in /var/www/drupal/includes/theme.inc on line 1879
(current PHP memory limit: 200M)
Sorry, this is too much guesswork as I don't understand enough about PHP syntax.
E.g. "inside the function" drupal_set_title(check_plain($gallery->name)); probably means somewhere inside the first (), or second (), either before, or after "check_plain", or either before, or after "$gallery->name".
Greetings, -asb
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Matt, the second argument in print_r() function tells it to acutally return the string instead of a direct output.
On Sun, Aug 21, 2011 at 8:43 AM, Matt Murphy mattyhead@gmail.com wrote:
Because print_r is a direct output function. You'd need some sort of buffering scheme to grab its output in chunks and assign it to a variable or put it in the database or whatever, once per usage.
On Sun, Aug 21, 2011 at 7:20 AM, Agon S. Buchholz asb@kefk.org wrote:
Progga wrote:
Try calling "drupal_set_message(print_r(debug_backtrace(), TRUE))" from inside the drupal_set_title() function at "includes/path.inc, line 206".
Thanks for your patience, but I had no luck with this either.
function drupal_get_title() { $title = drupal_set_title(); drupal_set_message(print_r(debug_backtrace(), TRUE))
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
return $title; }
and
function drupal_get_title() { $title = drupal_set_title();
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); } drupal_set_message(print_r(debug_backtrace(), TRUE)) return $title; }
result in:
Parse error: syntax error, unexpected T_IF in /var/www/drupal/includes/path.inc on line 235
respctively
Parse error: syntax error, unexpected T_RETURN in /var/www/drupal/includes/path.inc on line 239
(is this even "inside the function"?)
function drupal_set_title($title = NULL) { drupal_set_message(print_r(debug_backtrace(), TRUE)) static $stored_title;
results in
Parse error: syntax error, unexpected T_STATIC in /var/www/drupal/includes/path.inc on line 253
function drupal_get_title() { $title = drupal_set_title(drupal_set_message(print_r(debug_backtrace(), TRUE)));
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
results in lots of debug output all over the first page I', loading, and then in
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 54190338 bytes) in /var/www/drupal/includes/theme.inc on line
1879
(current PHP memory limit: 200M)
Sorry, this is too much guesswork as I don't understand enough about PHP syntax.
E.g. "inside the function" drupal_set_title(check_plain($gallery->name)); probably means somewhere inside the first (), or second (), either before, or after "check_plain", or either before, or after "$gallery->name".
Greetings, -asb
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Ah! Apologies.
On Sun, Aug 21, 2011 at 7:56 AM, Franz Glauber franz.glauber@gmail.com wrote:
Matt, the second argument in print_r() function tells it to acutally return the string instead of a direct output.
On Sun, Aug 21, 2011 at 8:43 AM, Matt Murphy mattyhead@gmail.com wrote:
Because print_r is a direct output function. You'd need some sort of buffering scheme to grab its output in chunks and assign it to a variable or put it in the database or whatever, once per usage.
On Sun, Aug 21, 2011 at 7:20 AM, Agon S. Buchholz asb@kefk.org wrote:
Progga wrote:
Try calling "drupal_set_message(print_r(debug_backtrace(), TRUE))" from inside the drupal_set_title() function at "includes/path.inc, line 206".
Thanks for your patience, but I had no luck with this either.
function drupal_get_title() { $title = drupal_set_title(); drupal_set_message(print_r(debug_backtrace(), TRUE))
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
return $title; }
and
function drupal_get_title() { $title = drupal_set_title();
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); } drupal_set_message(print_r(debug_backtrace(), TRUE)) return $title; }
result in:
Parse error: syntax error, unexpected T_IF in /var/www/drupal/includes/path.inc on line 235
respctively
Parse error: syntax error, unexpected T_RETURN in /var/www/drupal/includes/path.inc on line 239
(is this even "inside the function"?)
function drupal_set_title($title = NULL) { drupal_set_message(print_r(debug_backtrace(), TRUE)) static $stored_title;
results in
Parse error: syntax error, unexpected T_STATIC in /var/www/drupal/includes/path.inc on line 253
function drupal_get_title() { $title = drupal_set_title(drupal_set_message(print_r(debug_backtrace(), TRUE)));
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
results in lots of debug output all over the first page I', loading, and then in
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 54190338 bytes) in /var/www/drupal/includes/theme.inc on line 1879
(current PHP memory limit: 200M)
Sorry, this is too much guesswork as I don't understand enough about PHP syntax.
E.g. "inside the function" drupal_set_title(check_plain($gallery->name)); probably means somewhere inside the first (), or second (), either before, or after "check_plain", or either before, or after "$gallery->name".
Greetings, -asb
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
-- Franz
Sent from my laptop
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Agon, for the first 2 errors, you just forgot the ';' at the end of debugging lines.
Also, it is useful to have the Devel module installed ( http://drupal.org/project/devel) and use dsm() instead of drupal_set_message(), as it prints arrays in a very pleasant browseable interface (no need for print_r)
On Sun, Aug 21, 2011 at 8:20 AM, Agon S. Buchholz asb@kefk.org wrote:
Progga wrote:
Try calling "drupal_set_message(print_r(debug_backtrace(), TRUE))" from inside the drupal_set_title() function at "includes/path.inc, line 206".
Thanks for your patience, but I had no luck with this either.
function drupal_get_title() { $title = drupal_set_title(); drupal_set_message(print_r(debug_backtrace(), TRUE))
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
return $title; }
and
function drupal_get_title() { $title = drupal_set_title();
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); } drupal_set_message(print_r(debug_backtrace(), TRUE)) return $title; }
result in:
Parse error: syntax error, unexpected T_IF in /var/www/drupal/includes/path.inc on line 235
respctively
Parse error: syntax error, unexpected T_RETURN in /var/www/drupal/includes/path.inc on line 239
(is this even "inside the function"?)
function drupal_set_title($title = NULL) { drupal_set_message(print_r(debug_backtrace(), TRUE)) static $stored_title;
results in
Parse error: syntax error, unexpected T_STATIC in /var/www/drupal/includes/path.inc on line 253
function drupal_get_title() { $title = drupal_set_title(drupal_set_message(print_r(debug_backtrace(), TRUE)));
// during a bootstrap, menu.inc is not included and thus we cannot provide a title if (!isset($title) && function_exists('menu_get_active_title')) { $title = check_plain(menu_get_active_title()); }
results in lots of debug output all over the first page I', loading, and then in
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 54190338 bytes) in /var/www/drupal/includes/theme.inc on line 1879
(current PHP memory limit: 200M)
Sorry, this is too much guesswork as I don't understand enough about PHP syntax.
E.g. "inside the function" drupal_set_title(check_plain($gallery->name)); probably means somewhere inside the first (), or second (), either before, or after "check_plain", or either before, or after "$gallery->name".
Greetings, -asb
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
for the first 2 errors, you just forgot the ';' at the end of debugging lines.
Indeed, now I'm getting lots of debug output, including some serialized data I can not interpret. As far as I can see, "drupal_set_title" is also nowhere referenced. The array segment around the localized "image gallery" string looks like this:
[mission] => [primary_links] => Array ( [menu-29141] => Array ( [minipanel] => galerien [menu_minipanels_hover] => Array ( [position] => Array ( [target] => false [target_custom] => [type] => absolute [corner] => Array ( [target] => bottomLeft [tooltip] => topLeft ) ) [show] => Array ( [delay] => 100 [when] => Array ( [event] => mouseover ) [effect] => Array ( [type] => slide [length] => 0 ) ) [hide] => Array ( [fixed] => true [effect] => Array ( [type] => slide [length] => 0 ) ) [style] => Array ( [name] => light [width] => Array ( [min] => 0 [max] => 800 ) [border] => Array ( [width] => 3 [color] => #d3d3d3 [radius] => 0 ) [tip] => topLeft ) [mlid] => 29141 ) [attributes] => Array ( [title] => Bildergalerien ) [href] => galerie [title] => Galerien ) [menu-38332] => Array ( [minipanel] => reisen [menu_minipanels_hover] => Array ( [position] => Array ( [target] => false [target_custom] => [type] => absolute [corner] => Array ( [target] => bottomLeft [tooltip] => topLeft ) ) [show] => Array ( [delay] => 100 [when] => Array ( [event] => mouseover ) [effect] => Array ( [type] => slide [length] => 0 ) ) [hide] => Array ( [fixed] => true [effect] => Array ( [type] => slide [length] => 0 ) ) [style] => Array ( [name] => light ...
In the surrounding of the string appears the 'menu_minipanels' module; with trial-and-error I disabled this module and immediately got the "normal" titles back. I'm not sure if this suffices for a bug report against 'menu_minipanels', but I'll try it.
Thanks again to you all! -asb