The following error occurs if the Restrict By IP module is also installed:
TypeError: Drupal\block_class\Service\BlockClassHelperService::__construct(): Argument #10 ($currentUser) must be of type Drupal\Core\Session\AccountProxy, Drupal\restrict_by_ip\Session\AccountProxy given, called in /Users/dicksb/Sites/MAMP/moweb7/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in Drupal\block_class\Service\BlockClassHelperService->__construct() (line 118 of modules/contrib/block_class/src/Service/BlockClassHelperService.php).
The attached patch replaces any uses of Drupal\Core\Session\AccountProxy with Drupal\Core\Session\AccountProxyInterface.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | block_class-account-proxy-3293637-4.patch | 2.35 KB | alex.bukach |
| account_proxy.patch | 1.94 KB | wrd-oaitsd |
Issue fork block_class-3293637
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kbentham commentedTested this on a site that is on version 9.5.2 of Drupal, using version 4.0.0-beta1 of restrict_by_ip and it works great.
Comment #3
chris matthews commentedComment #4
alex.bukach commentedRe-rolled the patch.
Comment #5
dydave commentedPorting patch to 4.0.x.
Comment #8
dydave commentedSorry for the late reply on this issue and thank you very much everyone for the code contributions! 🙏
Just rolled in the patch from #4 into MR !70.
Since these changes had already been reviewed, tested and pending for a very long time, I went ahead and merged them above at #7 without further delay 😅
I wasn't able to test the changes myself manually though: I didn't try to install the module and reproduce the error and all...
But looking at the suggested changes from the patches, it made complete sense to replace a dependency on the class
\Drupal\Core\Session\AccountProxywith the interface\Drupal\Core\Session\AccountProxyInterface.This actually caught my attention when working on MR !67, when I reviewed all the properties of the
BlockClassHelperServiceclass to remove the unused ones.I'm not sure why I hesitated and didn't make the change myself at this point... 😅
(perhaps it was a little "too" much in a single merge request 😅)
In any case, thank you very much for catching this one. 👍
Marking issue as Fixed, for now.
Feel free to let us know if you would have any questions or concerns on any aspects of the latest code changes or the module in general, we would surely be glad to hear your feedback. 😊
Thanks in advance!