If the load functions result in 404 we change the router item into FALSE which destroys the delivery callback -- essentially we can't deliver a not found in anything but HTML.

Comments

chx’s picture

Status: Active » Needs review
StatusFileSize
new2.85 KB

Status: Needs review » Needs work

The last submitted patch, deliver_callback_keep.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.67 KB

Patch didn't work because we kept $store, which did not contain the unseralized page/theme_arguments.

Adjusted the patch slightly to simply use $map to conditionally put the $router_item into $router_items.

berdir’s picture

StatusFileSize
new2.9 KB

Ups, that contained debug code.

berdir’s picture

StatusFileSize
new3.28 KB

I guess it would be good to add a test for this, I'm not sure if I fully understand it. This is only for the case when there *is* a router item, right? Obviously, when there isn't, there can't be a delivery callback stored with it :)

Anyway, I was wondering if there is a way that allows to do this without requiring another drupal_static() array and those internal arguments...

- What about returning the router_item with 'map' and access set to FALSE in the case when $map is FALSE? We need a additional check in menu_execute_active_handler() then but everything else should then work correctly.

- I also think we can drop the first internal argument of menu_get_item() if menu_set_item() directly injects the router item into the drupal_static() cache. We use that pattern (sharing static cache between multiple functions) in other instances too. I'm putting this in the same patch to test it, we can easily do this in a separate issue.

Status: Needs review » Needs work

The last submitted patch, deliver_callback_keep3.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.29 KB

Fixed the patch in #5.

Status: Needs review » Needs work

The last submitted patch, deliver_callback_keep4.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.65 KB

Added the same check ($item['map'] to menu_tree_page_data(). Maybe the api change is too big... Anyway, the patch in #4 is still a valid solution too.

Status: Needs review » Needs work

The last submitted patch, deliver_callback_keep5.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new3.65 KB

And now with the correct braces...

chx’s picture

StatusFileSize
new3.01 KB

Don't change the return value of menu_get_item() this late. That's a non-starter I am afraid. I like #4 but it changed the strict checking against FALSE to an empty. I rerolled with strict checks. And a test would be good yes.

nightowl77’s picture

Subscribe. Want to test this when I get a moment

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.