php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37812 aggregate_methods_by_list fails to take certain methods
Submitted: 2006-06-15 03:20 UTC Modified: 2006-08-26 14:15 UTC
From: wickedfather at hotmail dot com Assigned: bjori (profile)
Status: Closed Package: Class/Object related
PHP Version: 4.4.2 OS: Win 98SE
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wickedfather at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-06-15 03:20 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-26 14:15 UTC] bjori@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC