|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57723 Allow __call intercept overload magic
Submitted: 2007-06-27 10:40 UTC Modified: 2017-10-24 23:02 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: vinyanov at poczta dot onet dot pl Assigned:
Status: Suspended Package: operator (PECL)
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: vinyanov at poczta dot onet dot pl
New email:
PHP Version: OS:


 [2007-06-27 10:40 UTC] vinyanov at poczta dot onet dot pl

I love the extension. :) However, could __call possibly catch requests for non-declared overload methods? It would:

* Help maintain the code brief
* Consist with call_user_func behaviour
* Say we overload methods within a class hierarchy and result of the overload yields an object of the original class. Cumulation of logic inside __call would save repeating the similar routine in each method:

// calculating effect of the overload
$class = get_class();
return new $class($result);

Reproduce code:
class Person
	function __call($meth, $args)
		switch(substr($meth, 2))
			case 'add':	return 'Couple';
			case 'sub':	return 'Part';

$john = new Person;
echo $john + 1;

Expected result:

Actual result:
Notice: Object of class Person could not be converted to int in C:\www\main\phppm\test.php on line 16


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-29 13:10 UTC]
Sure, that's certainly feasible.... I'll see what I can do, no promises on when though...
 [2017-10-24 06:23 UTC]
-Status: Assigned +Status: Open -Assigned To: pollita +Assigned To:
 [2017-10-24 23:01 UTC]
-Package: operator +Package: Scripting Engine problem
 [2017-10-24 23:02 UTC]
-Status: Open +Status: Suspended -Package: Scripting Engine problem +Package: operator
 [2017-10-24 23:02 UTC]
The operator PECL package have not had a release for 4 years and development activity seems to have ceased, if a new maintainer picks up this package, then this report should be re-opened
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 18:01:35 2024 UTC