<?xml version="1.0"?>
<?xml-stylesheet
href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/search.php">
    <title>PEAR Bug Search Results</title>
    <link>http://pear.php.net/bugs/search.php?cmd=display&amp;package_name%5B0%5D=Event_Dispatcher</link>
    <description>Search Results</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bug/19457" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18926" />
      <rdf:li rdf:resource="http://pear.php.net/bug/18789" />
      <rdf:li rdf:resource="http://pear.php.net/bug/15271" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7939" />
      <rdf:li rdf:resource="http://pear.php.net/bug/7459" />

     </rdf:Seq>
    </items>
  </channel>

  <image rdf:about="http://pear.php.net/gifs/pearsmall.gif">
    <title>PEAR Bugs</title>
    <url>http://pear.php.net/gifs/pearsmall.gif</url>
    <link>http://pear.php.net/bugs</link>
  </image>

    <item rdf:about="http://pear.php.net/bug/19457">
      <title>Event_Dispatcher: Bug 19457 [Assigned] Deprecated practice with PHP 5</title>
      <link>http://pear.php.net/bugs/19457</link>
      <content:encoded><![CDATA[<pre>Event_Dispatcher Bug
Reported by svanner
2012-06-06T03:13:01+00:00
PHP: 5.3.10 OS: Linux Ubuntu 12.04 Package Version: 1.1.0

Description:
------------
Line 249 here under causes a deprecated error message :

$notification =&amp; new $this-&gt;_notificationClass($object, $nName, $info);

I suggest to change the code with something like this:

	$notification = new $this-&gt;_notificationClass($object, $nName, $info);
        $notification_ref =&amp; $notification;
        return $this-&gt;postNotification($notification_ref, $pending, $bubble);

Test script:
---------------
None

Expected result:
----------------
Error message disapears

Actual result:
--------------
Deprecated practice message occurs at line 249</pre>]]></content:encoded>
      <description><![CDATA[<pre>Event_Dispatcher Bug
Reported by svanner
2012-06-06T03:13:01+00:00
PHP: 5.3.10 OS: Linux Ubuntu 12.04 Package Version: 1.1.0

Description:
------------
Line 249 here under causes a deprecated error message :

$notification =&amp; new $this-&gt;_notificationClass($object, $nName, $info);

I suggest to change the code with something like this:

	$notification = new $this-&gt;_notificationClass($object, $nName, $info);
        $notification_ref =&amp; $notification;
        return $this-&gt;postNotification($notification_ref, $pending, $bubble);

Test script:
---------------
None

Expected result:
----------------
Error message disapears

Actual result:
--------------
Deprecated practice message occurs at line 249</pre>]]></description>
      <dc:date>2012-06-06T21:26:59+00:00</dc:date>
      <dc:creator>stephane &amp;#x64;&amp;#111;&amp;#x74; vannerom &amp;#x61;&amp;#116; gmail &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Event_Dispatcher Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18926">
      <title>Event_Dispatcher: Documentation Problem 18926 [Open] addObserver() doesn't notify of pending notifications for new global observer</title>
      <link>http://pear.php.net/bugs/18926</link>
      <content:encoded><![CDATA[<pre>Event_Dispatcher Documentation Problem
Reported by jausions
2011-10-23T22:31:57+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 1.1.0

Description:
------------
If a new observer is added to the dispatcher with EVENT_DISPATCHER_GLOBAL, all existing pending notifications are NOT sent.

This is borderline buggy behavior. This ticket could be converted to &quot;Request&quot; with addObserver() taking an additional parameter to force all the pending notifications to be sent to the new observer. (Or create a addGlobalObserver() method that would do it.)

At the very least, documentation should be updated to reflect that limitation. It is currently a little bit misleading.</pre>]]></content:encoded>
      <description><![CDATA[<pre>Event_Dispatcher Documentation Problem
Reported by jausions
2011-10-23T22:31:57+00:00
PHP: Irrelevant OS: Irrelevant Package Version: 1.1.0

Description:
------------
If a new observer is added to the dispatcher with EVENT_DISPATCHER_GLOBAL, all existing pending notifications are NOT sent.

This is borderline buggy behavior. This ticket could be converted to &quot;Request&quot; with addObserver() taking an additional parameter to force all the pending notifications to be sent to the new observer. (Or create a addGlobalObserver() method that would do it.)

At the very least, documentation should be updated to reflect that limitation. It is currently a little bit misleading.</pre>]]></description>
      <dc:date>2011-10-23T22:31:57+00:00</dc:date>
      <dc:creator>pear &amp;#x61;&amp;#116; 11abacus &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Event_Dispatcher Documentation Problem</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/18789">
      <title>Event_Dispatcher: Bug 18789 [Open] Not installed from SVN</title>
      <link>http://pear.php.net/bugs/18789</link>
      <content:encoded><![CDATA[<pre>Event_Dispatcher Bug
Reported by hm2k
2011-09-05T22:58:55+00:00
PHP: 5.3.6 OS:  Package Version: SVN

Description:
------------
I was unable to install the current SVN copy to the system.

Test script:
---------------
@required http://hm2k.googlecode.com/svn/trunk/code/shell/pearsvn

Expected result:
----------------
No errors, installed OK.

Actual result:
--------------
$ ./pearsvn Event_Dispatcher
[pearsvn] Export from SVN...
A    Event_Dispatcher
A    Event_Dispatcher/Event
A    Event_Dispatcher/Event/Dispatcher.php
A    Event_Dispatcher/Event/Notification.php
A    Event_Dispatcher/tests
A    Event_Dispatcher/tests/AllTests.php
A    Event_Dispatcher/tests/DispatcherTest.php
A    Event_Dispatcher/package.xml
A    Event_Dispatcher/examples
A    Event_Dispatcher/examples/notification-class.php
A    Event_Dispatcher/examples/debugging.php
A    Event_Dispatcher/examples/bubbling.php
A    Event_Dispatcher/examples/cancel.php
A    Event_Dispatcher/examples/object.php
Exported revision 316190.
[pearsvn] Make PEAR package...
Analyzing Event/Dispatcher.php
Analyzing Event/Notification.php
Warning: in Notification.php: class &quot;Event_Notification&quot; not 
prefixed with package name &quot;Event_Dispatcher&quot;
Warning: Channel validator warning: field &quot;date&quot; - Release 
Date &quot;2009-07-24&quot; is not today
Package Event_Dispatcher-1.1.0.tgz done
[pearsvn] Uninstall PEAR package...
pear/Event_Dispatcher not installed
[pearsvn] Install PEAR package...
ERROR: bad md5sum for file 
/usr/share/pear/test/Event_Dispatcher/tests/AllTests.php
[pearsvn] Cleanup...
[pearsvn] Done!</pre>]]></content:encoded>
      <description><![CDATA[<pre>Event_Dispatcher Bug
Reported by hm2k
2011-09-05T22:58:55+00:00
PHP: 5.3.6 OS:  Package Version: SVN

Description:
------------
I was unable to install the current SVN copy to the system.

Test script:
---------------
@required http://hm2k.googlecode.com/svn/trunk/code/shell/pearsvn

Expected result:
----------------
No errors, installed OK.

Actual result:
--------------
$ ./pearsvn Event_Dispatcher
[pearsvn] Export from SVN...
A    Event_Dispatcher
A    Event_Dispatcher/Event
A    Event_Dispatcher/Event/Dispatcher.php
A    Event_Dispatcher/Event/Notification.php
A    Event_Dispatcher/tests
A    Event_Dispatcher/tests/AllTests.php
A    Event_Dispatcher/tests/DispatcherTest.php
A    Event_Dispatcher/package.xml
A    Event_Dispatcher/examples
A    Event_Dispatcher/examples/notification-class.php
A    Event_Dispatcher/examples/debugging.php
A    Event_Dispatcher/examples/bubbling.php
A    Event_Dispatcher/examples/cancel.php
A    Event_Dispatcher/examples/object.php
Exported revision 316190.
[pearsvn] Make PEAR package...
Analyzing Event/Dispatcher.php
Analyzing Event/Notification.php
Warning: in Notification.php: class &quot;Event_Notification&quot; not 
prefixed with package name &quot;Event_Dispatcher&quot;
Warning: Channel validator warning: field &quot;date&quot; - Release 
Date &quot;2009-07-24&quot; is not today
Package Event_Dispatcher-1.1.0.tgz done
[pearsvn] Uninstall PEAR package...
pear/Event_Dispatcher not installed
[pearsvn] Install PEAR package...
ERROR: bad md5sum for file 
/usr/share/pear/test/Event_Dispatcher/tests/AllTests.php
[pearsvn] Cleanup...
[pearsvn] Done!</pre>]]></description>
      <dc:date>2011-09-05T22:58:55+00:00</dc:date>
      <dc:creator>hm2k &amp;#x61;&amp;#116; php &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>Event_Dispatcher Bug</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/15271">
      <title>Event_Dispatcher: Feature/Change Request 15271 [Assigned] Converted for php5</title>
      <link>http://pear.php.net/bugs/15271</link>
      <content:encoded><![CDATA[<pre>Event_Dispatcher Feature/Change Request
Reported by snytkine
2008-12-07T22:34:24+00:00
PHP: 5.2.0 OS: RHEL4 Package Version: 1.0.0

Description:
------------
Hi
I converted this package to be used with PHP5, made some vars really private, changed == to === in many places, which is specially important in cases like == 0 and == true
changed __construct to private, getInstance() to singleton,
is_a() to instanceof, removed passing objects by reference,
added __toString, added 2 Exception classes extending PEAR_Exception, added some input variables check to addObserver() that throw exceptions on validation failures,
added option to pass only an object as argument to addObserver() but object must have Notify() method.
This is sort of an implementation of observer design pattern  - must have Notify(). 
also added type hinting to postNotification()

Please have a look and maybe we can release the Event_Dispatcher2 for php5</pre>]]></content:encoded>
      <description><![CDATA[<pre>Event_Dispatcher Feature/Change Request
Reported by snytkine
2008-12-07T22:34:24+00:00
PHP: 5.2.0 OS: RHEL4 Package Version: 1.0.0

Description:
------------
Hi
I converted this package to be used with PHP5, made some vars really private, changed == to === in many places, which is specially important in cases like == 0 and == true
changed __construct to private, getInstance() to singleton,
is_a() to instanceof, removed passing objects by reference,
added __toString, added 2 Exception classes extending PEAR_Exception, added some input variables check to addObserver() that throw exceptions on validation failures,
added option to pass only an object as argument to addObserver() but object must have Notify() method.
This is sort of an implementation of observer design pattern  - must have Notify(). 
also added type hinting to postNotification()

Please have a look and maybe we can release the Event_Dispatcher2 for php5</pre>]]></description>
      <dc:date>2011-09-29T12:41:58+00:00</dc:date>
      <dc:creator>cert21 &amp;#x61;&amp;#116; ptd &amp;#x64;&amp;#111;&amp;#x74; net</dc:creator>
      <dc:subject>Event_Dispatcher Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7939">
      <title>Event_Dispatcher: Feature/Change Request 7939 [Open] Inheritance of Event_Dispatcher</title>
      <link>http://pear.php.net/bugs/7939</link>
      <content:encoded><![CDATA[<pre>Event_Dispatcher Feature/Change Request
Reported by enrico
2006-06-19T16:33:55+00:00
PHP: 5.1.4 OS: FreeBSD Package Version: 1.0.0

Description:
------------
I tried to inherit the Event_Dispatcher class. The problem is the singleton pattern part, that create an instance of Event_Dispatcher. Their is no way no configure this like the notification class (setNotificationClass).

I wrote a patch to fix this.

--- /usr/local/share/pear/Event/Dispatcher.php  Mon Jun 19 18:06:29 2006
+++ /usr/local/share/pear/Event/Dispatcher.php.bak      Mon Jun 19 17:45:15 2006
@@ -42,8 +42,7 @@
  * @global array $GLOBALS[&quot;_Event_Dispatcher&quot;]
  */
 $GLOBALS['_Event_Dispatcher'] = array(
-                                  'NotificationClass' =&gt; 'Event_Notification',
-                                  'EventDispatcherClass' =&gt; 'Event_Dispatcher'
+                                  'NotificationClass' =&gt; 'Event_Notification'
                                      );
 
 /**
@@ -123,9 +122,9 @@
      * @access  private
      * @param   string      Name of the notification dispatcher.
      */
-    function Event_Dispatcher()
+    function Event_Dispatcher($name)
     {
-        Event_Dispatcher::__construct();
+        Event_Dispatcher::__construct($name);
     }
 
     /**
@@ -136,8 +135,9 @@
      * @access  private
      * @param   string      Name of the notification dispatcher.
      */
-    function __construct()
+    function __construct($name)
     {
+        $this-&gt;_name = $name;
         $this-&gt;_notificationClass = $GLOBALS['_Event_Dispatcher']['NotificationClass'];
     }
 
@@ -158,18 +158,12 @@
         static $dispatchers = array();
 
         if (!isset($dispatchers[$name])) {
-            $dispatchers[$name] = new $GLOBALS['_Event_Dispatcher']['EventDispatcherClass'];
-            $dispatchers[$name]-&gt;name = $name;
+            $dispatchers[$name] = new Event_Dispatcher($name);
         }
 
         return $dispatchers[$name];
     }
 
-    function setEventDispatcherClass($class)
-    {
-       $GLOBALS['_Event_Dispatcher']['EventDispatcherClass'] = $class;
-    }
-
     /**
      * Registers an observer callback
      *
@@ -472,7 +466,7 @@
      */
     function setNotificationClass($class)
     {
-        if (isset($this) &amp;&amp; is_a($this, $GLOBALS['_Event_Dispatcher']['EventDispatcherClass'])) {
+        if (isset($this) &amp;&amp; is_a($this, 'Event_Dispatcher')) {
             $this-&gt;_notificationClass = $class;
             return true;
         }</pre>]]></content:encoded>
      <description><![CDATA[<pre>Event_Dispatcher Feature/Change Request
Reported by enrico
2006-06-19T16:33:55+00:00
PHP: 5.1.4 OS: FreeBSD Package Version: 1.0.0

Description:
------------
I tried to inherit the Event_Dispatcher class. The problem is the singleton pattern part, that create an instance of Event_Dispatcher. Their is no way no configure this like the notification class (setNotificationClass).

I wrote a patch to fix this.

--- /usr/local/share/pear/Event/Dispatcher.php  Mon Jun 19 18:06:29 2006
+++ /usr/local/share/pear/Event/Dispatcher.php.bak      Mon Jun 19 17:45:15 2006
@@ -42,8 +42,7 @@
  * @global array $GLOBALS[&quot;_Event_Dispatcher&quot;]
  */
 $GLOBALS['_Event_Dispatcher'] = array(
-                                  'NotificationClass' =&gt; 'Event_Notification',
-                                  'EventDispatcherClass' =&gt; 'Event_Dispatcher'
+                                  'NotificationClass' =&gt; 'Event_Notification'
                                      );
 
 /**
@@ -123,9 +122,9 @@
      * @access  private
      * @param   string      Name of the notification dispatcher.
      */
-    function Event_Dispatcher()
+    function Event_Dispatcher($name)
     {
-        Event_Dispatcher::__construct();
+        Event_Dispatcher::__construct($name);
     }
 
     /**
@@ -136,8 +135,9 @@
      * @access  private
      * @param   string      Name of the notification dispatcher.
      */
-    function __construct()
+    function __construct($name)
     {
+        $this-&gt;_name = $name;
         $this-&gt;_notificationClass = $GLOBALS['_Event_Dispatcher']['NotificationClass'];
     }
 
@@ -158,18 +158,12 @@
         static $dispatchers = array();
 
         if (!isset($dispatchers[$name])) {
-            $dispatchers[$name] = new $GLOBALS['_Event_Dispatcher']['EventDispatcherClass'];
-            $dispatchers[$name]-&gt;name = $name;
+            $dispatchers[$name] = new Event_Dispatcher($name);
         }
 
         return $dispatchers[$name];
     }
 
-    function setEventDispatcherClass($class)
-    {
-       $GLOBALS['_Event_Dispatcher']['EventDispatcherClass'] = $class;
-    }
-
     /**
      * Registers an observer callback
      *
@@ -472,7 +466,7 @@
      */
     function setNotificationClass($class)
     {
-        if (isset($this) &amp;&amp; is_a($this, $GLOBALS['_Event_Dispatcher']['EventDispatcherClass'])) {
+        if (isset($this) &amp;&amp; is_a($this, 'Event_Dispatcher')) {
             $this-&gt;_notificationClass = $class;
             return true;
         }</pre>]]></description>
      <dc:date>2006-06-19T16:33:55+00:00</dc:date>
      <dc:creator>mail &amp;#x61;&amp;#116; enricostahn &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Event_Dispatcher Feature/Change Request</dc:subject>
    </item>
    <item rdf:about="http://pear.php.net/bug/7459">
      <title>Event_Dispatcher: Feature/Change Request 7459 [Open] Add support for filtering notifications by class hierarchy rather than name</title>
      <link>http://pear.php.net/bugs/7459</link>
      <content:encoded><![CDATA[<pre>Event_Dispatcher Feature/Change Request
Reported by jared@...
2006-04-22T18:10:13+00:00
PHP: Irrelevant OS: Mac OS X 10.4 Package Version: 1.0.0

Description:
------------
When using the third argument of addObserver to filter 
notifications based on class name, the problem is that only 
that single class name is used when checking the class that 
posted a notification. If a subclass of that class posts a 
notification, the notification will be filtered out, 
resulting in a 1:1 coupling of an observer and a single 
superclass rather than a coupling of an observer and a class 
hierarchy. So I changed the postNotification method slightly 
to check the class hierarchy so that if a superclass in the 
hierarchy matches the class name given via addObserver, it 
doesn't filter out the notification.

The patch:

--- Event/Dispatcher.php	2005-09-22 08:37:10.000000000 
-0700
+++ DispatcherNEW.php	2006-04-22 11:03:56.000000000 -0700
@@ -267,6 +267,8 @@
             $this-&gt;_pending[$nName][] =&amp; $notification;
         }
         $objClass = get_class($notification-
&gt;getNotificationObject());
+		$objClasses = array(strtolower($objClass));
+		while($objClass = get_parent_class($objClass)) 
{ $objClasses[] = strtolower($objClass); }
 
         // Find the registered observers
         if (isset($this-&gt;_ro[$nName])) {
@@ -276,7 +278,7 @@
                     return $notification;
                 }
                 if (empty($rObserver['class']) ||
-                	strcasecmp($rObserver['class'], 
$objClass) == 0) {
+                	array_search(strtolower($rObserver
['class']), $objClasses) !== false) {
                     call_user_func_array($rObserver
['callback'], array(&amp;$notification));
                     $notification-
&gt;increaseNotificationCount();
                 }</pre>]]></content:encoded>
      <description><![CDATA[<pre>Event_Dispatcher Feature/Change Request
Reported by jared@...
2006-04-22T18:10:13+00:00
PHP: Irrelevant OS: Mac OS X 10.4 Package Version: 1.0.0

Description:
------------
When using the third argument of addObserver to filter 
notifications based on class name, the problem is that only 
that single class name is used when checking the class that 
posted a notification. If a subclass of that class posts a 
notification, the notification will be filtered out, 
resulting in a 1:1 coupling of an observer and a single 
superclass rather than a coupling of an observer and a class 
hierarchy. So I changed the postNotification method slightly 
to check the class hierarchy so that if a superclass in the 
hierarchy matches the class name given via addObserver, it 
doesn't filter out the notification.

The patch:

--- Event/Dispatcher.php	2005-09-22 08:37:10.000000000 
-0700
+++ DispatcherNEW.php	2006-04-22 11:03:56.000000000 -0700
@@ -267,6 +267,8 @@
             $this-&gt;_pending[$nName][] =&amp; $notification;
         }
         $objClass = get_class($notification-
&gt;getNotificationObject());
+		$objClasses = array(strtolower($objClass));
+		while($objClass = get_parent_class($objClass)) 
{ $objClasses[] = strtolower($objClass); }
 
         // Find the registered observers
         if (isset($this-&gt;_ro[$nName])) {
@@ -276,7 +278,7 @@
                     return $notification;
                 }
                 if (empty($rObserver['class']) ||
-                	strcasecmp($rObserver['class'], 
$objClass) == 0) {
+                	array_search(strtolower($rObserver
['class']), $objClasses) !== false) {
                     call_user_func_array($rObserver
['callback'], array(&amp;$notification));
                     $notification-
&gt;increaseNotificationCount();
                 }</pre>]]></description>
      <dc:date>2006-04-22T18:10:13+00:00</dc:date>
      <dc:creator>jared &amp;#x61;&amp;#116; intuitivefuture &amp;#x64;&amp;#111;&amp;#x74; com</dc:creator>
      <dc:subject>Event_Dispatcher Feature/Change Request</dc:subject>
    </item>
</rdf:RDF>
