Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '2.2'

* 2.2:
  Fixed XmlFileLoaderTest::testLoadThrowsExceptionWithInvalidFileEvenWithoutSchemaValidation
  moved file hash calculation to own method
  [Validator] Add check for existing metadata on property
  added support for the X-Forwarded-For header (closes #6982, closes #7000)
  fixed the IP address in HttpCache when calling the backend
  [EventDispatcher] Added assertion.
  [EventDispathcer] Fix removeListener
  [DependencyInjection] Add clone for resources which were introduced in 2.1
  [DependencyInjection] Allow frozen containers to be dumped to graphviz
  Fix 'undefined index' error, when entering scope recursively
  [Security] fixed session creation on login (closes #7011)
  replaced usage of the deprecated pattern routing key (replaced with path)
  Add dot character `.` to legal mime subtype regular expression
  [HttpFoundation] fixed the creation of sub-requests under some circumstancies (closes #6923, closes #6936)
  • Loading branch information...
commit 2e1fce7bb3ea06d9e42756f1dd3edf966420c755 2 parents 4cc4643 + 45c43ff
@fabpot fabpot authored
Showing with 24 additions and 1 deletion.
  1. +1 −1  EventDispatcher.php
  2. +23 −0 Tests/EventDispatcherTest.php
View
2  EventDispatcher.php
@@ -106,7 +106,7 @@ public function removeListener($eventName, $listener)
}
foreach ($this->listeners[$eventName] as $priority => $listeners) {
- if (false !== ($key = array_search($listener, $listeners))) {
+ if (false !== ($key = array_search($listener, $listeners, true))) {
unset($this->listeners[$eventName][$priority][$key], $this->sorted[$eventName]);
}
}
View
23 Tests/EventDispatcherTest.php
@@ -244,6 +244,29 @@ public function testEventReceivesTheDispatcherInstance()
$this->dispatcher->dispatch('test');
$this->assertSame($this->dispatcher, $dispatcher);
}
+
+ /**
+ * @see https://bugs.php.net/bug.php?id=62976
+ *
+ * This bug affects:
+ * - The PHP 5.3 branch for versions < 5.3.18
+ * - The PHP 5.4 branch for versions < 5.4.8
+ * - The PHP 5.5 branch is not affected
+ */
+ public function testWorkaroundForPhpBug62976()
+ {
+ $dispatcher = new EventDispatcher();
+ $dispatcher->addListener('bug.62976', new CallableClass());
+ $dispatcher->removeListener('bug.62976', function() {});
+ $this->assertTrue($dispatcher->hasListeners('bug.62976'));
+ }
+}
+
+class CallableClass
+{
+ public function __invoke()
+ {
+ }
}
class TestEventListener
Please sign in to comment.
Something went wrong with that request. Please try again.