php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48649 Black box method dispatch violated with magic methods
Submitted: 2009-06-22 17:27 UTC Modified: 2009-06-22 17:53 UTC
From: me at evancarroll dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.10 OS: Linux
Private report: No CVE-ID: None
 [2009-06-22 17:27 UTC] me at evancarroll dot com
Description:
------------
In response to misclassified bug report http://bugs.php.net/bug.php?id=34739

I don't think you understand this bug report, this issue is that you can't know when a method is defined as being magic or not without providing some method of introspection into the class, not currently provided.

In perl this is simple:
//**** START EXAMPLE ****///
package Bar;
sub AUTOLOAD { print "dynamic"; }

package Foo;
our @ISA = 'Bar';
sub static { print "static" }
sub new { bless +{} }

my $obj = Foo->new;
$obj->static;
$obj->dynamic; # Not dependant on it being defined dynamic/static
//**** END EXAMPLE ****///

The issue is in PHP Bar methods have to be static for method dispatch and invocation to work, if Bar changes to use Magic methods it has to use a special syntax. This makes all subclasses of Bar dependent on Bar's method implementation. This is categorically wrong and is violation of Black Box for PHP's OOP.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-22 17:53 UTC] colder@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of #42937, which is fixed already.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 22 13:00:02 2025 UTC