I've encountered a bug that causes paths to always be set to "/n" when updating nodes. I can consistently replicate on my current site (running D7.0) but cannot replicate on a fresh D7.0 install. I've located the cause and am interested to see if it is in fact a bug.
Running:
- PHP 5.3
- D7.0
- Pathauto 7.x-1.x-dev
On line 316 of pathauto.module there is the following code:
$path = drupal_get_path_alias($uri['path'], $language);
During my tests the drupal_get_path_alias() returns a string, so $path is always set as a string.
on line 353 there is a conditional checking for the presence of an array within the $path variable:
if (!empty($path['alias'])) {
...
If drupal_get_path_alias returns a string $path['alias'] will return the value 'n'. As a partial work around I tried the following on line 353 of pathauto.module:
if (is_array($path) && !empty($path['alias'])) {
...
That allows me to update the pathauto alias. Am I experiencing a bug or is there something funky in my Drupal install that is causing drupal_get_path_alias() to return a string instead of an array?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1080712-pathauto.patch | 1.18 KB | dave reid |
Comments
Comment #1
dave reidCan you please test the following patch?
Comment #2
ngmaloney commentedYep. That patch seems to solve the problem. Thanks!
Comment #3
dave reidGreat! Committed to Git!
http://drupalcode.org/project/pathauto.git/commit/af17ad5