Re: Fix for #53727 (is_subclass_of resolution with interfaces)
| From: | Anthony Ferrara | Date: | Wed, 29 Jun 2011 21:12:59 +0000 |
| Subject: | Re: Fix for #53727 (is_subclass_of resolution with interfaces) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53683@lists.php.net to get a copy of this message | ||
> are you kidding, right?
var_dump('Foo' instanceof 'Bar');
//Fatal Error: instanceof expects an object instance, constant given
On Wed, Jun 29, 2011 at 5:05 PM, Martin Scotta <martinscotta@gmail.com> wrote:
> On Wed, Jun 29, 2011 at 5:25 PM, Paul Dragoonis <dragoonis@gmail.com> wrote:
>
>> On Wed, Jun 29, 2011 at 9:22 PM, David Zülke
>> <david.zuelke@bitextender.com> wrote:
>> > On 29.06.2011, at 22:20, Paul Dragoonis wrote:
>> >
>> >> On Wed, Jun 29, 2011 at 8:49 PM, Ralph Schindler <ralph@smashlabs.com>
>> wrote:
>> >>> Correct.
>> >>>
>> >>> I was hasty in that example, the first was copied & tested (and is
>> reflected
>> >>> in the test, as is that variation of what I wrote up.)
>> >>>
>> >>> Either way, test and patch work in 5_3.
>> >>
>> >> Doesn't this functionality confuse matters?
>> >>
>> >> If this patch is added, is there now no difference between instanceof
>> >> and is_subclass_of(). If this is the case my question is then why do
>> >> we have two methods to do the same thing?
>> >>
>> >> I thought instanceof was for parent classes + interfaces.. and
>> >> is_subclass_of() was just for parent classes.
>> >
>> > instanceof is a language construct and only operates on object instances.
>> >
>>
>> I didn't spot you could pass a string into is_subclass_of() I thought
>> it was only objects. With that in mind it would be good to have
>> subclass_of() include interfaces.
>>
>>
> are you kidding, right?
>
> $class = 'stdClass';
> $instance = new $class;
> var_dump( $instance instanceof $class );
>
>
>
>>
>> > David
>> >
>> >
>> >
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>