#37812 [Opn->Csd]: aggregate_methods_by_list fails to take certain methods

From: Date: Sat, 26 Aug 2006 14:15:42 +0000
Subject: #37812 [Opn->Csd]: aggregate_methods_by_list fails to take certain methods
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101366@lists.php.net to get a copy of this message
 ID:               37812
 Updated by:       bjori@php.net
 Reported By:      wickedfather at hotmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Class/Object related
 Operating System: Win 98SE
 PHP Version:      4.4.2
-Assigned To:      
+Assigned To:      bjori
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2006-06-15 03:20:10] wickedfather at hotmail dot com

Description:
------------
aggregate_methods_by_list fails to aggregate certain methods that are
definitely not present in the object

Reproduce code:
---------------
class Absorber
{
		/**
		*   Assigns object's properties from supplied array
		*   @param array associative
		*/

	function absorb($data)
	{
		$props = get_object_vars($this);

		foreach (array_keys($props) as $prop)
		{
		    if (isset($data[$prop]))
		    {
		        $this->$prop = $data[$prop];
		    }
		}
	}
}


class User
{
	function User($id = NULL)
	{
		// doesn't work
		aggregate_methods_by_list($this, 'Absorber', array('absorb'));
		echo
'<pre>Aggregation:'.print_r(aggregation_info($this),1).'</pre>';
	}
}

Expected result:
----------------
Expectation is to see the method absorb in the aggregation list, and to
be available as a method.  The problem can be worked around by using 

aggregate_methods_by_regexp($this, 'Absorber', '/absorb/');

Actual result:
--------------
No methods are present in the aggregation list


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37812&edit=1


Thread (2 messages)

« previous php.bugs (#101366) next »