Re: [PHP-DEV] foreach with null

2005-10-27 Thread Andi Gutmans
I think we should be keeping the warning (i.e. -1 for the change). I don't see a reason why overloaded objects can't expose an API of an empty array() instead of changing this behavior to fit the implementation. But even if it weren't so, there has to be a good reason to change the general case

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Marcus Boerger
Hello Jochem, Thursday, October 27, 2005, 12:49:57 PM, you wrote: > Jani Taskinen wrote: >> On Thu, 27 Oct 2005, Jochem Maas wrote: >> >>> advanced code should be checking vars properly before using them and, >>> well, >>> for any given foreach loop there is often enough an 'if >>> (!count($ar

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Jochem Maas
Jani Taskinen wrote: On Thu, 27 Oct 2005, Jochem Maas wrote: advanced code should be checking vars properly before using them and, well, for any given foreach loop there is often enough an 'if (!count($array))'-like statement to take care of the 'empty' case. and in cases when speed is very i

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Derick Rethans
On Thu, 27 Oct 2005, Hannes Magnusson wrote: > On 10/27/05, Derick Rethans <[EMAIL PROTECTED]> wrote: > > > > On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: > > > > > IMHO this is a bad idea, if you really wanted to support NULL in a > > > particular case you, as a developer could do: > > > php -r '

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Jani Taskinen
On Thu, 27 Oct 2005, Jochem Maas wrote: advanced code should be checking vars properly before using them and, well, for any given foreach loop there is often enough an 'if (!count($array))'-like statement to take care of the 'empty' case. and in cases when speed is very important ..and wh

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Hannes Magnusson
On 10/27/05, Derick Rethans <[EMAIL PROTECTED]> wrote: > > On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: > > > IMHO this is a bad idea, if you really wanted to support NULL in a > > particular case you, as a developer could do: > > php -r '$n=NULL; foreach((array)$n as $v);' > > > > Making NULL usag

Re: [PHP-DEV] foreach with null

2005-10-27 Thread Derick Rethans
On Wed, 26 Oct 2005, Ilia Alshanetsky wrote: > IMHO this is a bad idea, if you really wanted to support NULL in a > particular case you, as a developer could do: > php -r '$n=NULL; foreach((array)$n as $v);' > > Making NULL usage transparent where array is expects will lead to > difficult to debu

Re: [PHP-DEV] foreach with null

2005-10-26 Thread Jochem Maas
Ilia Alshanetsky wrote: IMHO this is a bad idea, if you really wanted to support NULL in a particular case you, as a developer could do: php -r '$n=NULL; foreach((array)$n as $v);' Making NULL usage transparent where array is expects will lead to difficult to debug code. hi :-) the warning fo

Re: [PHP-DEV] foreach with null

2005-10-26 Thread Ilia Alshanetsky
IMHO this is a bad idea, if you really wanted to support NULL in a particular case you, as a developer could do: php -r '$n=NULL; foreach((array)$n as $v);' Making NULL usage transparent where array is expects will lead to difficult to debug code. -1 for removing the warning. Ilia -- PHP Inter

Re: [PHP-DEV] foreach with null

2005-10-25 Thread Marcus Boerger
Hello Christian, Tuesday, October 25, 2005, 7:28:09 PM, you wrote: > Ants Aasma wrote: >> +-0 on the foreach issue, but with the SPL Iterators I can see where >> Marcus is coming from. > Ok, I can see the reason behind it now as casting to array is not an > option for objects with SPL Iterator

Re: [PHP-DEV] foreach with null

2005-10-25 Thread Christian Schneider
Ants Aasma wrote: +-0 on the foreach issue, but with the SPL Iterators I can see where Marcus is coming from. Ok, I can see the reason behind it now as casting to array is not an option for objects with SPL Iterators. One little side-note: Programmers will still have to do an if($obj) check i

Re: [PHP-DEV] foreach with null

2005-10-25 Thread Ants Aasma
Antony Dovgal wrote: On 25.10.2005 19:39, Ants Aasma wrote: It currently is equal: $ php -r 'var_dump(null == array()); var_dump((array) null);' bool(true) array(0) { } No, there aren't equal. Use === and you'll see the difference. At least the manual says that the == operator is named equa

Re: [PHP-DEV] foreach with null

2005-10-25 Thread John Coggeshall
+1 as well if and only if this applies to IS_NULL On Tue, 2005-10-25 at 02:45 +0400, Antony Dovgal wrote: > I'd say silently ignoring it and moving along is fine here. > Only if the var IS_NULL, but this is the case. > > So I'm +1. > > On 25.10.2005 02:22, Marcus Boerger wrote: > > Hello interna

Re: [PHP-DEV] foreach with null

2005-10-25 Thread Antony Dovgal
On 25.10.2005 19:39, Ants Aasma wrote: It currently is equal: $ php -r 'var_dump(null == array()); var_dump((array) null);' bool(true) array(0) { } No, there aren't equal. Use === and you'll see the difference. -- Wbr, Antony Dovgal -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] foreach with null

2005-10-25 Thread Ants Aasma
It currently is equal: $ php -r 'var_dump(null == array()); var_dump((array) null);' bool(true) array(0) { } Ants Jani Taskinen wrote: Will the patch make it silently ignore also empty string and 0? If not, -1. (what's with null being suddenly equal to empty array? :) --Jani On Tue

Re: [PHP-DEV] foreach with null

2005-10-24 Thread Jani Taskinen
Will the patch make it silently ignore also empty string and 0? If not, -1. (what's with null being suddenly equal to empty array? :) --Jani On Tue, 25 Oct 2005, Marcus Boerger wrote: Hello internals, i would like to change foreach a tiny bit. Actually i don't like the warning wh

Re: [PHP-DEV] foreach with null

2005-10-24 Thread Antony Dovgal
I'd say silently ignoring it and moving along is fine here. Only if the var IS_NULL, but this is the case. So I'm +1. On 25.10.2005 02:22, Marcus Boerger wrote: Hello internals, i would like to change foreach a tiny bit. Actually i don't like the warning when using foreach with null. [EMAIL

Re: [PHP-DEV] foreach with null

2005-10-24 Thread Rob Richards
Marcus Boerger wrote: i would like to change foreach a tiny bit. Actually i don't like the warning when using foreach with null. Marcus, you already know my feelings on this one. +1 Rob -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub