On Tue, 15 Nov 2005, Dmitry Stogov wrote:

> On Tue, 15 Nov 2005, Derick Rethans wrote:
>
> > On Tue, 15 Nov 2005, Dmitry Stogov wrote:
> >
> > > dmitry              Tue Nov 15 11:49:44 2005 EDT
> > >
> > >   Modified files:              (Branch: PHP_5_1)
> > >     /ZendEngine2    zend_compile.c
> > >   Log:
> > >   Allow "null" default value for arguments with array type hint
> >
> > I didn't implement this because in those cases you should set the
> > default to = array(), and this is working fine even before your 
> > patch:
> >
> > function boo(array $ar = array())
> > {
> > }
> >
> > This is why I didn't implement this for array, as it doesn't
> > make much
> > sense to me.
>
> I think it make a lot of sense.
> Before the patch "function foo(array $x = null)" may fail at execution time,
> because "null" is not an array.

Yes, and that is perfectly fine. In this case you would usually want to 
have an empty array, and not merely a "null" anyway. It is different 
from an object, because there is no "empty object" or something like 
that.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to