[drupal-devel] [bug] nodeapi 'settings' call sends string instead of object for $node value

chx drupal-devel at drupal.org
Sun Mar 6 10:10:20 UTC 2005


Issue status update for http://drupal.org/node/16384

 Project:      Drupal
 Version:      cvs
 Component:    node system
 Category:     bug reports
-Priority:     normal
+Priority:     critical
 Assigned to:  crunchywelch
 Reported by:  crunchywelch
 Updated by:   chx
 Status:       patch

I have also noted this, even submitted a patch (which I have now marked
as duplicate, although I think that was better) and because this breaks
two core modules (comment and upload) I mark this critical.


chx



Previous comments:
------------------------------------------------------------------------

January 29, 2005 - 08:50 : crunchywelch

Attachment: http://drupal.org/files/issues/node_24.patch (1.42 KB)

when the 'settings' nodeapi operation is invoked, a string containing
the type of node is sent for the $node argument, instead of an object
like the rest of the operations. This breaks comment.module, and is
inconsistent with the rest of the operations and documentation. 
This small patch fixes the problem.


------------------------------------------------------------------------

January 31, 2005 - 20:39 : Dries


 * Invoke a hook_nodeapi() operation in all modules.
 *
 * @param &$node
 *   Either a node object, node array, or a string containing the node
type.

Looks like the node_invoke_nodeapi function is broken.  It used to be
possible to pass a $type.


------------------------------------------------------------------------

March 6, 2005 - 07:38 : asimmonds

This also affects upload.module and about 6 contributed modules.
What's the best way to fix this?
Change the node_invoke_nodeapi() phpdoc to only accept a node object or
change node_invoke_nodeapi() to accept a string or array and convert to
object before passing to the _nodeapi hooks.
4.5 worked because a $node object was created and populated with $type
before calling node_invoke_nodeapi()
Using upload.module as a example, a side-effect of this bug is that the
node type settings are saved as upload_ instead of upload_nodetype into
the variables table.


------------------------------------------------------------------------

March 6, 2005 - 11:04 : Dries

OK, so let's go with this (or chx's slightly better fix) and update the
PHPdoc accordingly.





More information about the drupal-devel mailing list