Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_compile.c [RSS Feed]

#1 Nov. 15, 2005 19:53:09

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_compile.c


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

Offline

  • Root
  • » PHP
  • » [PHP-DEV] RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend_compile.c [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support