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

aasarava’s picture

Sorry, 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.

jcnventura’s picture

I 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

aasarava’s picture

Hi. 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()?

jcnventura’s picture

Status: Active » Fixed

Actually 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

aasarava’s picture

Seems to work in my testing so far. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.