Hello, thanks for the module. I noticed that when I set up a custom 404 page for my site, the print module generates a fatal error when I try to visit the /print URL. I tested this on a clean install of Drupal 6.10 with Print 6.x-1.6.
I believe it has to do with the _print_generate_path() function in print.page.inc calling menu_set_active_item($path) before it checks for a 404 error. Is there a way to re-order this to check for the error earlier? Thanks.
Comments
Comment #1
aasarava commentedSorry, I meant the function is in print.pages.inc.
The fatal error is:
Fatal error: Unsupported operand types in /home/dev/public_html/dlive/includes/common.inc on line 1542
Also, to clarify, the error occurs whenever you try to access not just /print, but any URL with /print at the beginning that doesn't actually exist.
So if you have a node with id 20, /print/20 will work. But /print/blah will lead to a fatal error. This is a problem because it does not take visitors to the correct custom 404 error page but shows a PHP fatal error instead.
Comment #2
jcnventuraI took a look at this, and the problem is some kind of strange problem inside Drupal. The sequence goes something like this:
1. _print_generate_path
a. menu_set_active_item($path);
b. menu_execute_active_handler($path);
4. drupal_not_found();
a. menu_set_active_item($path);
b. menu_execute_active_handler($path);
5. theme_image
6. Fatal error
I guess that the call to menu_execute_active_handler inside _print_generate_path somehow interferes with the second one.. I don't know how to fix this at the moment...
João
Comment #3
aasarava commentedHi. Is it necessary to call menu_execute_active_handler() *before* the call to drupal_not_found(), if drupal_not_found() also calls menu_execute_active_handler? Can you maybe wrap this in an if-statement that checks earlier if you need to call drupal_not_found()?
Comment #4
jcnventuraActually the problem was in calling drupal_get_title() for non-existing paths.. I move that call to after the drupal_not_found() area and I am no longer capable of reproducing your problem. When the next dev gets built, please try it.
João
Comment #5
aasarava commentedSeems to work in my testing so far. Thank you!