Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When trying to use the Entity Save action in rules with simplenews installed the site crashes with a 500 error.
Detail
This action calls entity_access() for all entity types with 'save' as the $op and NULL as the $entity.
This calls simplenews_newsletter_access() with 'save' as the $op and NULL as the $entity. However, simplenews_newsletter_access() requires the second argument to be an instance of SimplenewsNewsletter.
Solution
Remove type hinting from the second argument of simplenews_newsletter_access()
Comment | File | Size | Author |
---|---|---|---|
#3 | 2116719-3-fix_rules_and_simplenews.patch | 888 bytes | rlmumford |
#1 | 2116719-1-fix_rules_and_simplenews.patch | 476 bytes | rlmumford |
Comments
Comment #1
rlmumfordHere's a patch.
Comment #2
rlmumfordComment #3
rlmumfordThis is also a problem for subscribers.
Comment #4
miro_dietikerUnrelated, but here's a wrong comment: newsletter => subscriber
In 8.x the interface typing is intended: http://drupalfunctions.com/api/drupal/drupal!core!modules!system!entity....
But in 7.x this is the definition:
$entity: Optionally an entity to check access for. If no entity is given, it will be determined whether access is allowed for all entities of the given type.
So yes, it's optional. Any other occurence of hook_access() we need to fix?
Comment #7
miro_dietikerHmm, i like to see a test for this issue.