Hello Derick,

Tuesday, November 15, 2005, 8:19:28 PM, you wrote:

> 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.

I think "array $ar = null" is fine but strongly suggest we also allow
"array $ar = array()" (which we do as i was just being told) since that
would imo be the common default for typehinted array properties.

regards
marcus

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

Reply via email to