Problem/Motivation
We have this happening with entity_translation. This means two bugs: module_invoke_all('path_delete', $path); will be called with FALSE instead of an array, violating the API.
Also when drupal_clear_path_cache($path['source']); is called with $path = FALSE then, while you are not getting a warning (PHP WTF) but you are calling drupal_clear_path_cache(NULL); which enforces a whitelist rebuild. This is a (severe) performance bug.
Proposed resolution
Just get the hell out of dodge if the path already doesn't exist.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| path_delete.patch | 916 bytes | chx |
Comments
Comment #2
David_Rothstein commentedPossibly a duplicate of #1025904: path_delete() cannot handle multiple aliases and/or #2637570: path_delete() tries to delete non-existing path, leads to flushing whitelist cache?
Comment #3
chx commentedNo, this is a different bug, actually two: module_invoke_all('path_delete', $path); you will call this with FALSE instead of an array violating the API.
Also when you call drupal_clear_path_cache($path['source']); with $path = FALSE then, while you are not getting a warning (PHP WTF) but you are calling drupal_clear_path_cache(NULL); which enforces a whitelist rebuild. This is a (severe) performance bug.
Comment #4
chx commentedComment #5
chx commentedOpsie, forgot to set attribute.
Comment #6
fabianx commentedYup, agree that this is a severe performance bug affecting D7 only.
Comment #7
fabianx commentedUnless we need a test, I think this should be good to go.
Comment #8
David_Rothstein commentedI double-checked, and the patch at #1025904: path_delete() cannot handle multiple aliases fixes both the issues mentioned above (see also the issue summary there: )
Plus it already has tests.
I'm also not sure we'd want to add the TRUE/FALSE return value, since delete functions don't often do that?