-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #37812 aggregate_methods_by_list fails to take certain methods
Add test
- Loading branch information
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--TEST-- | ||
Bug #37812 (aggregate_methods_by_list fails to take certain methods) | ||
--FILE-- | ||
<?php | ||
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>'; | ||
} | ||
} | ||
new User; | ||
?> | ||
--EXPECT-- | ||
<pre>Aggregation:Array | ||
( | ||
[absorber] => Array | ||
( | ||
[methods] => Array | ||
( | ||
[0] => absorb | ||
) | ||
|
||
[properties] => Array | ||
( | ||
) | ||
|
||
) | ||
|
||
) | ||
</pre> | ||
|