Closed (fixed)
Project:
Porter Algorithm Search Stemmer
Version:
6.x-1.0
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Apr 2009 at 20:41 UTC
Updated:
5 Aug 2009 at 15:10 UTC
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
Comment #1
gregglesMuch 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.
Comment #2
jhodgdonIt'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.
Comment #3
jhodgdonThis is now fixed in the HEAD branch. See commit http://drupal.org/cvs?commit=237490
Comment #4
manishnamdeo commentedFunction 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.
Comment #5
gregglesI think #511930: Upgrade to Porter 2 algorithm is a better way to solve this.
Comment #6
jhodgdonYes. 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.