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?

CommentFileSizeAuthor
#1 1080712-pathauto.patch1.18 KBdave reid

Comments

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new1.18 KB

Can you please test the following patch?

ngmaloney’s picture

Status: Needs review » Reviewed & tested by the community

Yep. That patch seems to solve the problem. Thanks!

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.