Problem with drupal_execute in uc_product_kit_nodeapi
Jody Lynn - May 26, 2009 - 20:27
| Project: | Ubercart |
| Version: | 6.x-2.0-rc3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
| Issue tags: | ubercamp sprint |
Jump to:
Description
FYI: there's a core bug with drupal_execute that means trouble with uc_product_kit_nodeapi's use of it: #260934: Static caching: cannot call drupal_validate_form on the same form more than once
To reproduce:
Add a CCK text options widget (radio fields) to product kit content type.
Create two product kits which both include product foo.
Update product foo.
One of the product kits will have its CCK option value cropped down to 1 character.
Currently drupal_execute is broken if you use it more than once at a time. Might be better to switch to node_save.

#1
Lyle, is there a reason we aren't node_save()ing here?
#2
#3
The reason node_save() doesn't work is because hook_update() doesn't actually take a $node object. It takes the form values, which have been turned into an object that is almost like a node. Usually this is OK because most node forms map very easily to the node's structure. Product kits don't. Using drupal_execute() was the easiest way around it.
#4
Duplicate of the core issue. I tried fixing the way Ubercart handled it, but I didn't get anywhere. If anyone else wants to try, they can reopen the issue.