Re: 回复: [PHP-DEV] Re: bugs needs fix before 5. 4.1
2012/3/31 reeze <[email protected]>:
> 在 2012年3月31日星期六,下午3:31,Stas Malyshev 写道:
>
> On 3/30/12 7:27 PM, Yasuo Ohgaki wrote:
>
> Hi Stas,
>
> Just FYI.
> Following bugs are needed to be fixed before 5.4.1, I think.
>
> https://bugs.php.net/bug.php?id=61526
> Which is right, doc or code?
>
>
> Both. The parameter means that first argument (object) can be a string,
> and if it is, it will be passed to autoloader to find the class. See bug
> #55475 for the discussion.
>
> If is set to false does it means the first parameter can't be string?
> Can't we just make the last parameter to autoload=true|false.
> if the first parameter is a string then try to find the class if not try
> autoloadding.
>
> if string will not be a String Class in 5.* I think it's ok to do like
> this. eg: callable and many mixed paramter.
>
> what do you think?
You're right.
I've read too many bug reports today and confused :)
<?php
class Super {}
class Sub extends Super {}
// By default, 1st parameter may be string and treated as class name.
var_dump(is_subclass_of('Sub', 'Super')); // true
// Explicitly allow string as class name
var_dump(is_subclass_of('Sub', 'Super', true)); // true
// Do not allow string as a 1st parameter, so false.
var_dump(is_subclass_of('Sub', 'Super', false)); // false
?>
Therefore, 3rd parameter works for "Not allowing class name", but
it cannot be used to restrict autoloading.
Am I missing something? I'll read the report Stas mentioned from now.
Regards,
--
Yasuo Ohgaki
Thread (10 messages)