Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Session validation breaks when all event managers are intercepted
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Apr 16, 2014
1 parent 1a0e780 commit 3080d1b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace ZendDeveloperTools\Collector;

use Zend\EventManager\Event;

/**
* Event Data Collector Interface.
*
Expand Down
1 change: 0 additions & 1 deletion src/ZendDeveloperTools/Collector/MemoryCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
class MemoryCollector extends AbstractCollector implements EventCollectorInterface
{

/**
* @inheritdoc
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/
class EventLoggingListenerAggregate implements SharedListenerAggregateInterface
{

/**
*
* @var ServiceLocatorInterface
Expand Down Expand Up @@ -98,20 +97,26 @@ public function detachShared(SharedEventManagerInterface $events)
*/
public function onCollectEvent(Event $event)
{
$strict = $this->options->isStrict();
$strict = $this->options->isStrict();
$collectors = $this->options->getEventCollectors();

foreach ($collectors as $name => $collector) {
foreach ($collectors as $collector) {
if ($this->serviceLocator->has($collector)) {
$this->serviceLocator->get($collector)->collectEvent('application', $event);
/* @var $currentCollector \ZendDeveloperTools\Collector\EventCollectorInterface */
$currentCollector = $this->serviceLocator->get($collector);

$currentCollector->collectEvent('application', $event);
} else {
$error = sprintf('Unable to fetch or create an instance for %s.', $collector);

if ($strict === true) {
throw new ServiceNotFoundException($error);
} else {
$this->report->addError($error);
}
}
}

return true; // @TODO workaround, to be removed when https://github.com/zendframework/zf2/pull/6147 is fixed
}
}

1 comment on commit 3080d1b

@moderndeveloperllc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd, I use this with a sessioned app and never ran across this issue. Thanks for the fix. I gather breaking out $currentCollector is a coding preference of yours?

Please sign in to comment.