Closed (duplicate)
Project:
Pathauto
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Mar 2007 at 02:13 UTC
Updated:
8 Nov 2007 at 17:15 UTC
I am getting the following error when I try to edit serveral of my CCK type nodes:
PHP Catchable fatal error: Object of class stdClass could not be converted to string in /usr/local/drupal/sites/citris/modules/modules/pathauto/pathauto_node.inc on line 170,
This is a new error introduced in PHP 5.2 (http://us3.php.net/types.string)
Here is a fix, but I am sure there is a better way to deal with it:
// $placeholders[t('[catalias]')] = drupal_get_path_alias('taxonomy/term/'.$firsttermid);
if (!is_object($firsttermid) || method_exists($firsttermid, '__toString')) {
$firsttermid_str = (string)$firsttermid;
} else {
$firsttermid_str = 'Object';
}
$placeholders[t('[catalias]')] = drupal_get_path_alias('taxonomy/term/'.$firsttermid_str);
Comments
Comment #1
gregglesI'm having a hard time understanding where this goes - can you post it as a patch: http://drupal.org/diffandpatch ?
thanks.
Comment #2
starbow commentedIt goes at line 170 of pathauto_node.inc - but I didn't submit it as a patch since it is really just a hack job that keeps the error from crashing the module rather than actually fixing the underlying issue. I suspect that the real issue is that there are some cases where $firsttermid is not being set correctly, and this bug was just being silently ignored until PHP 5.2 started complaining about it.
Comment #3
gregglesWhat are the steps to repeat this. I'm now testing on PHP5.2 and haven't encountered this. Or is it 4.7 only? In which case I suggest upgrading to 5...
Comment #4
john.money commentedI can confirm related error when editing a CCK type node, though my linenumbers are different.
PHP 5.2.1
Drupal 5.1
Pathauto 1.1 (pathauto.module,v 1.44.2.5)
Comment #5
john.money commentedScratch that report... 29 April 2007 patch supplied by HorsePunchKid fixed it.
Comment #6
gregglesSo, I guess this is a duplicate - though starbow originaly raised it for 4.7, so maybe not.
Comment #7
gregglesNo, in fact it is still active in the 4.7 version of the module - though not on all PHP5.2 (I ran into it myself today on a site, but then can't reproduce it on my localhost).
The obvious workarounds are to use PHP4 or Upgrade to Drupal5. I don't plan to fix this.