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.
When a rule is added to an access filter that contains an IP range, the following error is thrown:
Error: Call to a member function isAllowed() on boolean in Drupal\access_filter\Entity\Filter->isAllowed() (line 213 of /docroot/modules/contrib/access_filter/src/Entity/Filter.php)
Example of a rule where this error is thrown:
Comment | File | Size | Author |
---|---|---|---|
#2 | access-filter-ip-range-error-3092308-2.patch | 785 bytes | edwardchiapet |
2019-11-04 at 2.13 PM.png | 9.88 KB | edwardchiapet |
Comments
Comment #2
edwardchiapetIt looks like the error is thrown because a boolean is returned in the condition that handles the IP ranges:
The `isAllowed()` method in `Filter.php` expects an `AccessResult` object in:
Attached is a patch that updates the return statement to return `AccessResult::allowed()` is the check passes and `AccessResult::forbidden()` if it fails.
Comment #3
edwardchiapetComment #4
wstocker CreditAttribution: wstocker at Mediacurrent commentedReviewed and tested using Drupal core version 8.8.1. The error has been fixed, and IP ranges are working.
Comment #6
hayashi CreditAttribution: hayashi commentedThank you for reporting issue and fixing it.
8.x-1.2 has been released with this fix.
Comment #7
hayashi CreditAttribution: hayashi commentedComment #8
hayashi CreditAttribution: hayashi commented