Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merged 2.0

  • Loading branch information...
commit 507c8b7eff0b871c9e41c163fe63c0d406179171 2 parents 0aea3d9 + 211ae4e
Fabien Potencier fabpot authored
2  Debug/ContainerAwareTraceableEventDispatcher.php
View
@@ -242,7 +242,7 @@ private function getListenerInfo($listener, $eventName)
if (!is_array($listener)) {
$listener = array($listener, '__invoke');
}
- $class = get_class($listener[0]);
+ $class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];
try {
$r = new \ReflectionMethod($class, $listener[1]);
$file = $r->getFileName();
2  HttpCache/Store.php
View
@@ -110,7 +110,7 @@ public function lookup(Request $request)
// find a cached entry that matches the request.
$match = null;
foreach ($entries as $entry) {
- if ($this->requestsMatch(isset($entry[1]['vary']) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
+ if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
$match = $entry;
break;
22 Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php
View
@@ -55,4 +55,26 @@ public function testClosureDoesNotTriggerErrorNotice()
$this->assertTrue($triggered, 'Closure should have been executed upon dispatch');
}
+
+ public function testStaticCallable()
+ {
+ $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+ $dispatcher = new ContainerAwareTraceableEventDispatcher($container, new StopWatch());
+
+ $dispatcher->addListener('onFooEvent', array(__NAMESPACE__.'\StaticClassFixture', 'staticListener'));
+
+ $dispatcher->dispatch('onFooEvent');
+
+ $this->assertTrue(StaticClassFixture::$called);
+ }
+}
+
+class StaticClassFixture
+{
+ static public $called = false;
+
+ static public function staticListener($event)
+ {
+ self::$called = true;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.