Getting the following errors running PHP 5.4:

Warning: Illegal string offset 'pathauto' in pathauto_field_attach_form() (line 300 of /sites/all/modules/pathauto/pathauto.module).
Warning: Illegal string offset 'pathauto' in pathauto_field_attach_form() (line 319 of /sites/all/modules/pathauto/pathauto.module).
Warning: Illegal string offset 'pathauto' in pathauto_field_attach_form() (line 329 of /sites/all/modules/pathauto/pathauto.module).

Files: 
CommentFileSizeAuthor
#8 openatrium-with-php5-5--1580466.patch1.64 KBsobi3ch
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openatrium-with-php5-5--1580466.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#7 illegalstringoffset-1580466-6.patch1022 bytesIgnigena
PASSED: [[SimpleTest]]: [MySQL] 316 pass(es).
[ View ]
#6 pathauto.module.zip6.78 KBhoebekewim
#4 illegalstringoffset-1580466-4.patch824 bytesIgnigena
FAILED: [[SimpleTest]]: [MySQL] 316 pass(es), 0 fail(s), and 12 exception(s).
[ View ]
#2 illegalstringoffset-1580466-2.patch899 bytesIgnigena
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/pathauto/pathauto.module.
[ View ]

Comments

I was able to surpress the errors by changing the function at line 294 to the following. It's not the most clean or compact code and I can't guarantee it's a good solve but hopefully this helps figure out the issue:

NEW (starts at line 294 of pathauto.module)

<?php
if (!isset($entity->path['pathauto'])) {
    if (!empty(
$id)) {
     
module_load_include('inc', 'pathauto');
     
$uri = entity_uri($entity_type, $entity);
     
$path = drupal_get_path_alias($uri['path'], $langcode);
     
$pathauto_alias = pathauto_create_alias($entity_type, 'return', $uri['path'], array($entity_type => $entity), $bundle, $langcode);
     
$pathauto_array = array(
         
$entity->path,
         
"pathauto" => ($path != $uri['path'] && $path == $pathauto_alias),
      );
     
//$entity->path["pathauto"] = ($path != $uri['path'] && $path == $pathauto_alias);
     
$entity->path=$pathauto_array;
    }
    else {
   
$pathauto_array = array(
         
$entity->path,
         
"pathauto" => TRUE,
      );
     
//$entity->path['pathauto'] = TRUE;
     
$entity->path=$pathauto_array;
    }
  }
?>

OLD (starts at line 294 of pathauto.module)

<?php
if (!isset($entity->path['pathauto'])) {
    if (!empty(
$id)) {
     
module_load_include('inc', 'pathauto');
     
$uri = entity_uri($entity_type, $entity);
     
$path = drupal_get_path_alias($uri['path'], $langcode);
     
$pathauto_alias = pathauto_create_alias($entity_type, 'return', $uri['path'], array($entity_type => $entity), $bundle, $langcode);
     
$entity->path["pathauto"] = ($path != $uri['path'] && $path == $pathauto_alias);
    }
    else {
     
$entity->path['pathauto'] = TRUE;
    }
  }
?>

Version:7.x-1.1» 7.x-1.x-dev
Status:Active» Needs review
StatusFileSize
new899 bytes
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/pathauto/pathauto.module.
[ View ]

It seems like $entity->path is sometimes a string not an array which is what is causing the warnings in PHP 5.4. I've attached a patch against the latest dev branch with my solution above cleaned up a tiny bit. I'm sure there's a more "proper" way of fixing this, so feel free to point out anything I've done wrong. Hopefully this at least helps push the issue along.

Status:Needs review» Needs work

The last submitted patch, illegalstringoffset-1580466-2.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new824 bytes
FAILED: [[SimpleTest]]: [MySQL] 316 pass(es), 0 fail(s), and 12 exception(s).
[ View ]

Trying again ... sorry.

Status:Needs review» Needs work

The last submitted patch, illegalstringoffset-1580466-4.patch, failed testing.

StatusFileSize
new6.78 KB

I don't know if this is the correct solution but it seems to fix the error:

Line 294 in pathauto.module:

if (!isset($entity->path['pathauto'])) {
    if (!empty($id)) {
      module_load_include('inc', 'pathauto');
      $uri = entity_uri($entity_type, $entity);
      $path = drupal_get_path_alias($uri['path'], $langcode);
      $pathauto_alias = pathauto_create_alias($entity_type, 'return', $uri['path'], array($entity_type => $entity), $bundle, $langcode);
      if(isset($entity->path)){
            $entity->path = array(
                  $entity->path,
                  'pathauto' => ($path != $uri['path'] && $path == $pathauto_alias),
            );
      }
      else{
            $entity->path = array(
                  'pathauto' => ($path != $uri['path'] && $path == $pathauto_alias),
            );
      }
    }
    else {
            $entity->path = array('pathauto' => TRUE);
    }
  }

I've placed my pathauto.module file in the annex.

Status:Needs work» Needs review
StatusFileSize
new1022 bytes
PASSED: [[SimpleTest]]: [MySQL] 316 pass(es).
[ View ]

Good call hoebekewim on the addition of the isset check. Addressed a few minor coding standards issues and rolled this into a patch, attached below.

Issue summary:View changes
StatusFileSize
new1.64 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch openatrium-with-php5-5--1580466.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I don't know this is useful but I'm adding patch that's working with Warning message in PHP 5.5 with openatrium 1.12

openatrium-with-php5-5--1580466.patch (1.64 KB)

Status:Needs review» Needs work

The last submitted patch, 8: openatrium-with-php5-5--1580466.patch, failed testing.