Thursday, April 4, 2013

Illegal offset type in isset or empty pathauto.inc:180

In my scenario, I was using "simplexml_load_file" and getting values in variable.
if ($child2->getName() == 'job_title') {
          print $node_title = $child2;
        }

passing $node_title to node->title using node object and was saving it.
It was working well in browser, when i was running script. But created a drush command for it 'drush impvac', which was resulting in

docroot$ drush impvac
Illegal offset type in isset or empty pathauto.inc:180            [warning]
Illegal offset type pathauto.inc:223                              [warning]

It was because node->title was not getting a plain string from xml, so just added 'check_plain' to dp my stuff.

if ($node_title != '') {
          $node->title = check_plain($node_title);
        }
And all was set.

No comments:

Post a Comment