Steps to reproduce

  1. Install a fresh copy of drupal-7.37 (using the Standard install profile), ctools-7.x-1.7, date-7.x-2.8, entity-7.x-1.6, rules-7.x-2.9, and views-7.x-3.11.
  2. Clone the Membership entity module: git clone --branch 7.x-1.x http://git.drupal.org/project/membership_entity.git and enable all three sub-modules (Membership Entity, Membership Entity Terms, Membership Entity Types).
  3. Log in as the super-administrator.
  4. Go to admin/people/permissions/roles and add an "Active member" role.
  5. Go to admin/people/permissions, set permissions as follows:
    • Membership Entity → Administer memberships: administrator
    • Membership Entity Terms → Administer membership terms: administrator
    • Membership Entity Types → Administer membership types: administrator
    • Membership Entity Types → Join as a Membership member: authenticated user, Active member, administrator
    • Membership Entity Types → Renew any Membership membership: administrator
    • Membership Entity Types → Renew own Membership membership: authenticated user, Active member, administrator
    • Membership Entity Types → View any Membership membership: administrator
    • Membership Entity Types → View own Membership membership: authenticated user, Active member, administrator
    • Membership Entity Types → Edit any Membership membership: administrator
    • Membership Entity Types → Edit own Membership membership: authenticated user, Active member, administrator
    • Membership Entity Types → Delete any Membership membership: administrator
    • Membership Entity Types → Delete own Membership membership: authenticated user, Active member, administrator
  6. Go to admin/memberships/types/manage/membership. Note that Grace period is set to None by default — don't change it. Add any membership term length (I chose 1 year, but any will work). Click Save configuration.
  7. Go to admin/people/create, and create a new user.
  8. Log out of the super-admin account, and log in as the new user.
  9. Go to user/join/membership. Click the Join button.
  10. Go to user. Click the Renew membership link.

You see:

Warning: DateTime::modify(): Failed to parse time string (none) at position 0 (n): The timezone could not be found in the database in _membership_entity_term_modify_date() (line 914 of sites/all/modules/membership_entity/modules/membership_entity_term/membership_entity_term.module).

Problem/Motivation

The grace period string is set to 'none'; but, rather than skipping modifying the date, the string 'none' is parsed directly:

function _membership_entity_term_modify_date(DateTime $date, $modifier) {
  $start_day = $date->format('j');
  $date->modify($modifier); // Line 914: $modifier === 'none' when the error occurs.

  /* ... */
}

Proposed resolution

Check if the grace period === 'none' before modifying the date (and avoid modifying the date if so).

Remaining tasks

  1. Write a patch
  2. Review and RTBC
  3. Commit

User interface changes

None.

API changes

None.

Comments

mparker17’s picture

Issue summary: View changes
mparker17’s picture

Assigned: mparker17 » Unassigned
Status: Active » Closed (cannot reproduce)

Whoops this happened on a patched version of the module for another issue; a clean version of the module doesn't have this problem.