2012/3/9 Lazare Inepologlou <linep...@gmail.com>
>
> Type casting combined with passing by reference is problematic in many ways. 
> Just an example:
>
> fuction foo( string & $buffer) { ... }
> foo( $my_buffer );
>
> Here, $my_buffer has just been declared, so it is null. Should this be an 
> error? I don't know! So, I think that that passing by reference should not be 
> (immediately) supported.
>

Hi, Lazare

This should at least throw an E_NOTICE :) And also an error as NULL is
not allowed here.

Let me modify your example:

fuction foo( string & $buffer = NULL) { ... }
foo( $my_buffer );

This would only raise the E_NOTICE because the variable has not been declared.
Or would you say that NULL is equal with an empty string (talking
about implicit casting)? I would not like that, but if, don't let it
be (int)0 or (bool)false as well.

Bye
Simon

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

Reply via email to