#48649 [Opn->Bgs]: Black box method dispatch violated with magic methods
ID: 48649
Updated by: colder@php.net
Reported By: me at evancarroll dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Linux
PHP Version: 5.2.10
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2009-06-22 17:27:45] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48649&edit=1
Thread (2 messages)