php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47228 New magic method like __call, but that is called even if the method exists
Submitted: 2009-01-28 10:55 UTC Modified: 2016-12-31 17:21 UTC
Votes:12
Avg. Score:4.6 ± 0.8
Reproduced:11 of 11 (100.0%)
Same Version:11 (100.0%)
Same OS:11 (100.0%)
From: logy at logy dot com dot br Assigned:
Status: Suspended Package: Class/Object related
PHP Version: 5.2.8 OS: Linux 2.6.20
Private report: No CVE-ID: None
 [2009-01-28 10:55 UTC] logy at logy dot com dot br
Description:
------------
Not exactly a bug but i didn't find another good place to post it.
I'd like to see a implemented magic method or something like that, with funcionality of the __call method but that hooks before any method that really EXISTS in the class. Something like that would be very util on implementations such as security and any other control over a multiple class design.
I think PHP a wonderful language, but for the first time, I found a problem in the language that won't fit my design needs, so, I expect my solicitation to be valid.

Reproduce code:
---------------
-

Expected result:
----------------
-

Actual result:
--------------
-

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-08 20:44 UTC] jani@php.net
-Package: Feature/Change Request +Package: Class/Object related
 [2012-03-04 18:04 UTC] nikic@php.net
-Summary: Magic method leaks +Summary: New magic method like __call, but that is called even if the method exists
 [2012-06-12 21:48 UTC] sebastien dot roux dot dev at gmail dot com
This problem can be solved in several ways when we can implements a design pattern on existing code, but when we works on products like magento when can't do anything, overiding classes ans methods is very strict and limited.

The only way is to implement a new magic method like '__call' but called only if method exists.
 [2013-01-26 08:19 UTC] info at ericdorr dot de
Since 2009 and still no implementation. Where I have to apply as Developer to fix that ?
 [2013-09-19 22:04 UTC] metamarkers at gmail dot com
Well, that's a problem with Magento. Not PHP. Magento has objectively terrible 
design.

Make your methods protected. __call() will be invoked if they're protected or 
private. If your system isn't flexible enough to allow that, and doesn't have 
some sort of event hook system, you need to reassess why you're using it in the 
first place.
 [2016-12-31 17:21 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2016-12-31 17:21 UTC] cmb@php.net
> Where I have to apply as Developer to fix that ?

You can apply for an VCS account via <http://php.net/git-php.php>.

However, this feature would require to pass the RFC process[1], so
I'm suspending this ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 03:01:27 2024 UTC