Re: is_a() - again - a better fix
| From: | Matthew Weier O'Phinney | Date: | Wed, 21 Sep 2011 13:57:35 +0000 |
| Subject: | Re: is_a() - again - a better fix | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-55570@lists.php.net to get a copy of this message | ||
On 2011-09-20, Alan Knowles <alan@akbkhome.com> wrote:
> Let's try and close this one.
>
> https://bugs.php.net/bug.php?id=55475
>
> I've just added a patch that adds is_class_of(), which is identical to
> is_subclass_of, and has the new feature of supporting strings and using
> the autoloader.
is_class_of() has a very different semantic meaning (in natural
language) than is_subclass_of() -- I know I wouldn't expect the behavior
it exhibits by looking at the name.
> It then reverts is_a() back to the previous behavior, and clarifies the
> documentation.
Reverting at this point adds a BC break on top of a BC break. Yes, the
original perhaps should not have happened (and likely wouldn't have, if
people had actually been testing the RCs...), but I'll argue again: the
new behavior is more correct.
Reverting at this point is simply going to cause more headaches:
"package X works for PHP versions X.Y - 5.3.6, and from 5.3.9 to
5.3.last" -- what a nightmare!
> This solves the BC issues, and also solves potential security issues
> with existing code accidentally passing $url's to the autoloader, and
> gives anyone who needs this new behavior a solution.
I'd argue that this fix also highlights the need for autoloaders to test
their arguments to see if they are getting something that looks like a
class name.
> Let's at least try and respect the new release RFC, and our users who
> appreciate PHP's efforts over the years to try and maintain BC. (it's
> one of it's few advantages these days...)
To respect the release RFC, we shouldn't introduce a new BC break
(breaking behavior with something already released).
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc