When no url_alias rows is present in db upon start of request, the static $count is set to '0', and the 'wipe' does not clear this state.
Steps to reproduce:
1.) clear url_alias cache
2.) create some code that does:
a.) sets an alias using path_set_alias()
b.) get the alias back, using drupal_get_path_alias()
The alias returned will be wrong, even though path_set_alias() calls drupal_clear_path_cache() (which just calls the drupal_lookup_path('wipe')).
Cause: the $count is not reset upon wipe.
The above issue gives me problems with creation of nodes during when using an installation profile.
Comment | File | Size | Author |
---|---|---|---|
#7 | 315656-drupal-lookup-path-count-wipe.patch | 524 bytes | Damien Tournoud |
#3 | drupal-lookup-path-wipe-315656-D7.patch | 525 bytes | Dave Reid |
#1 | path.inc-drupal-5.10.patch | 822 bytes | gielfeldt |
Comments
Comment #1
gielfeldt CreditAttribution: gielfeldt commentedHere's a patch that fixes the problem.
Comment #2
Dave ReidYou should just use unset($count). And this should probably be fixed in D7, then backported.
Comment #3
Dave ReidPatch for D7.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedOk.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commentedSince when can we unset static variables?
This probably doesn't work, and anyway, it should have a test.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedWhich means that if the unset is at the top of the function then it works well. Setting $count to NULL instead would work for this case.
Comment #7
Damien Tournoud CreditAttribution: Damien Tournoud commentedHere is a proper patch.
#204106: Test for translated path aliases now depends on this.
Comment #8
Dries CreditAttribution: Dries commentedI've committed this to CVS HEAD and DRUPAL-6. Thanks!
Comment #9
gpk CreditAttribution: gpk commentedComment #10
marcingy CreditAttribution: marcingy commentedMarking as won't fix as d5 is end of life.