Enable Devel's Execute PHP block (in the footer). The node resulting from dpm(menu_get_object()); has a rendered body, whereas an execution of dpm(node_load(arg(1))); returns the node with the original body from the database.

Comments

salvis’s picture

According to http://drupal.org/node/114774#menu_get_object (and to Coder), node_load(arg(1)) ought to be replaced with menu_get_object() but the body returned by the latter is unusable.

mile23’s picture

Have you investigated the Views module?

salvis’s picture

Why? This is a core-only issue.

mile23’s picture

Status: Active » Postponed (maintainer needs more info)

Well, if you're trying to put a node in a block, you can accomplish that and quite a few other things with Views.

If you're trying to modify the $node object before rendering then hook_nodeapi() with 'view' or 'load', or perhaps hook_view() is what you want.

Basically it's unclear what you're trying to do, which is why it's hard to address the problem.

salvis’s picture

Status: Postponed (maintainer needs more info) » Active

Thank you for trying to help, but this is not the point. hook_nodeapi('load') might have been a possible alternative at the time, but node_load(arg(1)) worked just fine.

I don't have the actual context anymore, but it doesn't really matter. We were calling a core function from a custom module and that core function didn't deliver what it promised.

If menu_get_object() is supposed to replace node_load(arg(1)) then it should deliver at least as much as the latter does.

The latter gives an unrendered body and this is what we needed, because we wanted to modify and re-save it. We weren't looking for a work-around, but we were reporting a core bug. I realize that menu_get_object() cannot be fixed anymore without risking to break code that relies on its misbehavior, but D6 should have an alternative that really delivers what http://drupal.org/node/114774#menu_get_object promises.

igorik’s picture

any progress here? it sounds like it can't be really replace of node_load() while it has this different behaviour.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.