Please restore the _pathauto_include function before making a 2.0 release. It seems like it is or at least used to be part of the official API and there's still mention that people should be using this function in the pathauto.inc file header. It got removed in pathauto.module in revision 1.158, but unfortunately the commit message doesn't mention the removal of this function.

The latest release of Ubercart (6.x-2.4) depends on this function being available in the uc_catalog submodule. It gave me a white screen of death and I saw this error message in the logs:

Call to undefined function _pathauto_include() in path/to/modules/ubercart/uc_catalog/uc_catalog.module on line 525

Comments

dave reid’s picture

Status: Active » Closed (won't fix)

It wasn't ever an API function. Modules that are calling this function will still not work with the latest code, so they need to be fixed.

dave reid’s picture

Status: Closed (won't fix) » Fixed

Just committed to both 6.x-2.x and 7.x-1.x to fix the reference to _pathauto_include() to use the proper method of module_load_include('inc', 'pathauto');

greggles’s picture

Status: Fixed » Active

I'd rather go the other way. That function clearly seems useful to me if others are using it so we should remove the underscore from the beginning to make it possible for others to use it.

And where's the patch you committed in #2? And where's the link to the cvs commit entry? If we look at most of the page doesn't have issues. I'm concerned about the best practices.

dave reid’s picture

Gah, sorry about that Greg. It was a documentation only change, so I didn't post a patch.
http://drupal.org/cvs?commit=449426
http://drupal.org/cvs?commit=449428

I'm worried that by adding this function back in the 6.x-2.x branch that we're continuing to hide the problem and not encouraging modules to fix their code as nothing would be evident that calling the function is doing the wrong thing.

greggles’s picture

When you say "hide the problem" what is the problem we're hiding?

dave reid’s picture

That modules should be using module_load_include('inc', 'pathauto') rather than _pathauto_include() to get access to the pathauto_create_alias() and other functions that they want to use.

Peter Bex’s picture

Sorry for the late reply, it just occurred to me that I should have a look at the issue list.

module_load_include does seem the "proper" way to do it. Having one huge function which loads everything doesn't strike me as particularly elegant. It's better if people only load the files that are absolutely necessary.

Originally I requested for restoring this function, but that's just because people are already using it. It could be marked "deprecated", and maybe even log a warning. At least keeping it around for a few months so that the ubercart people can get their act together would be a good idea. Otherwise people risk major breakage just updating pathauto.

greggles’s picture

Title: Restore _pathauto_include() before releasing 2.0 » Restore _pathauto_include() and have it watchdog a helpful error message about being deprecated

I agree with Peter's proposal.

This breaks too much to just rip out, IMO: http://drupal.org/search/apachesolr_multisitesearch/%22undefined%20funct...

dave reid’s picture

Version: 6.x-2.0-alpha3 » 6.x-2.x-dev
Assigned: Unassigned » dave reid
Priority: Critical » Major

I'm coming around on this, so I think it will be a good idea to put it back in.

dave reid’s picture

Status: Active » Needs review
StatusFileSize
new780 bytes
greggles’s picture

I think this will still cause fatal errors because people will assume code is included that isn't.

I basically feel we should revert the previously committed code and just add a watchdog saying it's been deprecated.

dave reid’s picture

Status: Needs review » Needs work

True, we only need to add module_load_include('inc', 'pathauto') since the token functions work by default and do not need includes.

dave reid’s picture

Revised patch that adds a watchdog notice, with helpful information about what file/function/line called _pathauto_include() so it can be reported back to the offending module. I added a test call to _pathauto_include in the token list function and attached screenshot is the watchdog message.

dave reid’s picture

Status: Needs work » Needs review
dave reid’s picture

Status: Needs review » Fixed

Talked with greggles on IRC and he liked it, so I'm committing #12 to CVS.
http://drupal.org/cvs?commit=466184

Status: Fixed » Closed (fixed)

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