The full error is:

WD php: Recoverable fatal error: Argument 1 passed to xmlsitemap_node_nodeapi() must be an instance of stdClass, null given, called in      [error]
.../modules/node/node.module on line 679 and defined in xmlsitemap_node_nodeapi() (line 81 of
.../sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module).

Inspecting the code I see

function xmlsitemap_node_nodeapi(stdClass &$node, $op, $a3 = NULL, $a4 = NULL) {

I'm not sure that stdClass is the right thing to put there. I removed stdClass and now drush cron succeeds.

Comments

dave reid’s picture

That would indicate something is passing it a very wrong value. It should never be getting NULL for $node.

beyond67’s picture

Im getting the same error.

fugazi’s picture

same Error

fugazi’s picture

I have to delete out § node. Please help. Thanks

Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)

Find the module that isn't doing the right thing and report the bug there. It is a Drupal standard to not babysit broken code for other modules. The three reporters on this issue, what modules do you have in common? Take the common list, figure out which one is broken, fix it, then supply that module's issue queue a patch.

fugazi’s picture

Sorry for my bad English

Argument 1 passed to xmlsitemap_node_nodeapi() must be an instance of stdClass, null given, called in .../modules/node/node.module on line 679 and defined in .../sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module in line 81.

location ../node/5576/edit
Referrer ../node/5576/edit

It comes when a review is changed

Many Thanks

Anonymous’s picture

So what is causing the node variable to be NULL? To debug in modules/node/node.module add a is_null() condition before line 641 and throw an exception when $node is NULL. Then you'll have a traceback to other functions. The node_invoke_nodeapi function parameter states that the $node variable is to be a node object. It doesn't state that it should be allowed to be NULL.

fugazi’s picture

sorry I'm not a professional, what I write before line 641? Can you tell me please exactly. Perhaps the code to write down what I should add. Many many thanks. Sorry for my bad english

Anonymous’s picture

sorry I'm not a professional, what I write before line 641?

I suggest you hire a professional then. Debugging requires someone who has a handle on what to do with the information collected. A good place to look for a professional is at http://drupal.org/drupal-services. You might also be interested in locating a user group near you by researching http://groups.drupal.org/groups.

neclimdul’s picture

same error.
I have a feeling it has to do with node_load being passed an invalid node somehow. Unfortunately, I think because node_invoke_nodeapi doesn't validate its arguments well enough, requiring a stdClass argument is not reasonable on xmlsitemap_node's part. Especially since it puts cron in a position where it can't progress without hacking the source of xmlsitemap_node on a live site...

neclimdul’s picture

I should be clear up a couple things. First, I'm actually actively investigating this ATM. I have a snapshot of our broken production env prior to kicking it and I'm tracing through the problem.

Also, by node_invoke_nodeapi not being diligent enough in its argument validation, if I'm reading the code correctly, node_load(-1); with xmlsitemap_node installed with cause the site to crash. This is because $node will be populated by the return of a database query which will return null. Then it is blindly passed into node_invoke_nodeapi which blindly passes it to to xmlsitemap_node_nodeapi() and then life sucks.

And finally, I'm curious if anyone else running into this problem is running the apachesolr module. An initial quick review makes it look like it is causing the flub on our site.

neclimdul’s picture

ugh, nm it was an untested and suppose to not called code path. for some reason solr was indexing excluded nodes somehow.

And I was wrong about node_load, its node_save thats fragile about its calling of node_invoke_nodeapi(). But node_save(NULL) is much more likely a dev problem then node_load(invalid_nid);

Still node sure forcing the argument is a good idea in this case but my problem is fixed.

bryansd’s picture

I started seeing this error too after upgrading to 6.x-2.0-beta2. I'm now on the March 31, 2011 version of 6.x-2.x-dev. It appears during a cron run after files are being deleted via the FeedAPI module.

I'm a little unclear with the discussion provided whether this is an XML Sitemap issue or due to another module.

bryansd’s picture

I should have also added that this was during a normal cron run and not running cron within drush.

Anonymous’s picture

I believe it to be a bug in feedapi. See #367111: Wrong use of node_save() and press the issue there.

steveedson’s picture

I've also just experienced this issue, and it wasn't because of a third party module. The item was added to the `queue` table, but had been deleted since the cron was ran.

So when the cron eventually starts, it gets to the item in the queue, can't load the node, and then bombs out with a fatal error. Can there be a simple check to make sure that node_load doesn't return false before trying to use it?

Thanks.