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.

  1. 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.

  1. Create a function correctly named (i.e. encrypt_decrypt() (without leading underscore) that duplicates of the current decrypt().
  2. Change the documentation to state that decrypt() is depreciated and that the canonical decrypt function is named encrypt_decrypt().
  3. Create a watchdog warning if a module calls the depreciated function.
  4. 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.

  1. Create a class named (i.e. Encrypt with methods named encrypt() decrypt().
  2. Change the documentation to state that the functions encrypt() anddecrypt() are depreciated and that clients should use the new methods.
  3. Create a watchdog warning if a module calls the depreciated functions.
  4. Remove encrypt() and decrypt() 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

gisle created an issue. See original summary.

gisle’s picture

Issue summary: View changes
ptmkenny’s picture

Status: Active » Closed (outdated)

Development of Encrypt for Drupal 7 has ended.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.