Problem/Motivation
At its core, the Drupal 7 Encrypt API provides two functions, encrypt() and decrypt().
Unfortunately, this clashes with current coding standards for function names, which state:
Functions should be named using lowercase, and words should be separated with an underscore. Functions should in addition have the grouping/module name as a prefix, to avoid name collisions between modules. (my emphasis)
The function named decrypt() is not named according to the standard. This function is currently a wrapper calling an internal function named _encrypt_decrypt() (leading underscore) that does the heavy lifting.
For the record, the Drupal 8 version of the project uses an object oriented approach that avoids this problem.
Proposed resolutions
There is currently no module named Decrypt, so that namespace is available.
I think there are at least three alternative solutions:
Solution 1:
Do nothing with the code, but grab the infringed namespace.
- Create a dummy project named "Decrypt", and thereby making the infringed namesapace unavailable for any other project.
Solution 2:
Make an incremental change in the procedureal API, resulting in an API change in release 7.x-3.0.
- Create a function correctly named (i.e.
encrypt_decrypt()(without leading underscore) that duplicates of the currentdecrypt(). - Change the documentation to state that
decrypt()is depreciated and that the canonical decrypt function is namedencrypt_decrypt(). - Create a watchdog warning if a module calls the depreciated function.
- Remove
decrypt()in release 7.x-3.0.
Solution 3:
Change the procedureal API to object oriented, resulting in an API change in release 7.x-3.0.
- Create a class named (i.e.
Encryptwith methods namedencrypt()decrypt(). - Change the documentation to state that the functions
encrypt()anddecrypt()are depreciated and that clients should use the new methods. - Create a watchdog warning if a module calls the depreciated functions.
- Remove
encrypt()anddecrypt()in release 7.x-3.0.
Remaining tasks
- Decide on the exact plan to move forward (e.g. "Solution 1", "Solution 2" or "Solution 3").
- Follow the steps outlined for the choosen solution.
User interface changes
None.
API changes
Solutions 2 and 3 will require clients to use another function when 7.x-3.0 is released.
If you use this module, please comment and indicate how you think we should proceed.
I'll also ping Drupal webmasters.
Comments
Comment #2
gisleComment #3
ptmkenny commentedDevelopment of Encrypt for Drupal 7 has ended.