After bootstrapping Drupal programatically and calling node_save, the following error occurs on line 249 of pathauto.module:
PHP Fatal error: Call to undefined function pathauto_get_placeholders()
I worked around it by adding:
require_once(drupal_get_path('module','pathauto').'/pathauto.inc');
immediately after drupal_bootstrap().
Comments
Comment #1
dave reid_pathauto_include() is called before that execution, so I don't know how this could go wrong. Maybe you're missing the pathauto.inc file?
Comment #2
gregglesThe code in question is:
We could potentially optimize a smidgen by moving the _pathauto_include() closer to the pathauto_get_placeholders, but I agree with Dave that it's hard to see how Pathauto is causing this.
Maybe some other module is using pathauto_get_placeholders?
Comment #3
_vid commentedI thought I was having a similar issue, but it turns out that I had updated to 6.x-2.0-alpha2 without realizing it.
Here's the error message I get when I try to edit a node:
"Fatal error: Call to undefined function pathauto_pattern_load_by_entity() in /.../sites/all/modules/pathauto/pathauto.inc on line 365"
I reinstalled 6.x-1.4 and everything works again.
So I suppose that could be an issue for 6.x-2.0-alpha2. Let me know if you'd like me to submit it as such.
I'm just happy that 1.4 is working.
Vid
Comment #4
greggles@vidr - did you clear the cache after updating? My guess is that this is a menu/cache related issue.
Comment #5
_vid commentedHi greggles,
I did clear the cache, a couple times in fact; I looked back at my install history in terminal and I found that I had updated the pathauto module to 6.x-2.0-alpha2 back on 8/19/10. Which is probably why I couldn't remember doing it.
I'm not sure why I wanted to update to an alpha install on a production site but I did.
I also installed 6.x-2.0-alpha2 on two other sites and they are working fine!
So I think the error was a result of conflict with some other module I installed recently.
Looking at the install history on the site in question; which wasn't showing that error last week, I had installed the latest version of webform_validation on 9-13 and linkchecker on 9-9.
So the error could have been as a result of a conflict with one of those.
Vid
Comment #6
dave reidSince no one else has been able to duplicate this and it seems like it has resolved itself, then I'm going to mark this as fixed.
Comment #8
dasjopathauto.inc doesn't get included in my case, when i'm using dpm(pathauto_cleanstring(...)) in the php custom code block.
Comment #9
dave reidYou can't just call the pathauto_cleanstring() function and expect it to work. You need to manually include the file otherwise you get an error:
module_load_include('inc', 'pathauto');Also please use proper issue queue etiquette and do not re-open closed issues.