There are quite a few functions in porterstemmer.module that lack the porterstemmer_ prefix on their function names.

According to Drupal coding standards (http://drupal.org/coding-standards) they should all be prefixed with the module name (see the Naming Conventions section, about half-way down the page). You might also want to use the prefix _porterstemmer_ for internal-use-only function, to make absolutely sure they won't be mistaken for hook functions. (The location module had this problem with a function named location_diff, which made a conflict with hook_diff in the diff module.)

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

Much of this code is based on work from elsewhere so it is left in the original format to make it easy to merge in updates from the outside code.

Is there a specific problem occurring now or is this just a best practice.

jhodgdon’s picture

It's an official Drupal coding standards best practice...

I didn't experience any difficulty, but some of those function names are pretty scary. I was especially worried by the funtion called "replace", eek! Maybe the upstream maintainers could be convinced to put some kind of a prefix on all of their functions?

Anyway, feel free to ignore. The code scared me, but I haven't experienced any specific problems.

jhodgdon’s picture

Status: Postponed (maintainer needs more info) » Fixed

This is now fixed in the HEAD branch. See commit http://drupal.org/cvs?commit=237490

manishnamdeo’s picture

Title: Function names should be prefixed » Function m() creates issues with ubercart
Priority: Normal » Critical
Status: Fixed » Active

Function m() creates issues with ubercart when using cybersource because m() function is already defined in HOP.php.
Renaming m() to mCount() in porterstemmer.module resolves the issue.

greggles’s picture

I think #511930: Upgrade to Porter 2 algorithm is a better way to solve this.

jhodgdon’s picture

Status: Active » Fixed

Yes. We'd really appreciate it if you could test the development version of Porter Stemmer, as detailed on that page. As soon as a few people test it successfully, it will become the next release. Thanks!

So I am marking this issue back to "fixed", since the fix has been checked in.

Status: Fixed » Closed (fixed)

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