Skip to content

Commit 75ba360

Browse files
authored
Merge pull request #172 from visto9259/visto9259/fix-strategy-priority
Patched UnauthorizedStrategy.php to set the listener priority to -1 s…
2 parents fa12f23 + d4df786 commit 75ba360

File tree

2 files changed

+39
-25
lines changed

2 files changed

+39
-25
lines changed

composer.lock

Lines changed: 29 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/View/Strategy/UnauthorizedStrategy.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
namespace Lmc\Rbac\Mvc\View\Strategy;
2323

24+
use Laminas\EventManager\EventManagerInterface;
2425
use Laminas\Http\Response as HttpResponse;
2526
use Laminas\Mvc\MvcEvent;
2627
use Laminas\View\Model\ViewModel;
@@ -43,6 +44,15 @@ public function __construct(UnauthorizedStrategyOptions $options)
4344
$this->options = $options;
4445
}
4546

47+
/**
48+
* @inheritDoc
49+
*/
50+
public function attach(EventManagerInterface $events, $priority = 1): void
51+
{
52+
// Temporary fix to priority to make sure listeners runs after MVC's exception handler
53+
$this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'onError'], -1);
54+
}
55+
4656
/**
4757
* @private
4858
*/

0 commit comments

Comments
 (0)