[TYPO3-dev] Extensions need update for 4.3!

ries van Twisk typo3 at rvt.dds.nl
Thu Oct 9 18:46:34 CEST 2008


On Oct 9, 2008, at 11:32 AM, Dmitry Dulepov wrote:

> Hi!
>
> ries van Twisk wrote:
>> We all know as programmers that NULL is special, it doesn't define a
>> specific type.
>
> I am not a programmer than... If I see that it must be an array, I  
> pass array, not null.
>
>> And there is nothing in PHP that prevents you to pass NULL even  
>> though
>> you can explicately define in the function a array needs to be  
>> passed.
>
> Yes? I just tried:
>
> <?php
>
> function foo(array $al) {
>        echo 'La-la' . chr(10);
> }
>
> foo(null);
>
> ?>
>
> Catchable fatal error: Argument 1 passed to foo() must be an array,  
> null given, called in /Users/dima/1.php on line 7 and defined in / 
> Users/dima/1.php on line 3
>
> So null is not valid when array is expected.



Please read Ernesto's proposal about this structure : function  
foo(array $al=null) {.....}

It will force allow of array, but allows null also, but doesn't allow  
anything else (strings, integers etc...)

Ries








More information about the TYPO3-dev mailing list