Drupal Association members fund grants that make connections all over the world.
[ Please credit fago; this patch appeared in http://drupal.org/node/269877#comment-3351152 .
It's only been put into a separate issue to -hopefully- streamline fixes, and renamed to fit this issue. ]
Premise behind this issue: When updating an existing path alias through path_set_alias(), it is always best to pass the 'pid' field for the existing alias. (And this will stay true, irrespective of what changes may or may not be made in path_set_alias() through other issues.)
This often isn't done.
path_nodeapi('update') checks for the presence $node->pid, but since this is not a 'regular' node property, $node->pid is not present except after a manual node edit (as filled by path_form_alter()). Any other node_save() call will result in path_set_alias() being called without the 'pid' argument filled.
The attached patch fixes this.
While this patch does not fix potential problems inside path_set_alias(), the beauty of it is:
- given above premise, it is easy to deduce that there are no adverse effects. It does not need any tests or discussions about which exact circumstances triggered a bug. (Unlike some of the fifteen million other open issues relating to path_set_alias() and i18n and updating nodes.)
- it has no influence on the fifteen million other patches floating around, since the change does not touch the code in these patches. It can therefore be applied independently.**
- it may however have a mitigating effect on the circumstances that trigger the issues with path_set_alias(). It is therefore hoped that it will make discussions w.r.t. solving the other issues easier - like determining whether or not some issues are duplicate.
**I didn't check all fifteen million issues, but IMHO this holds true for:
#218 (and#228 too)
(separate issue from above three)