Hi, Drupal core is now E_NOTICE free or it's supposed to be. a) Please file separate issues if you find any. And drop me a mail about them. b) Do not introduce notices with your patches. If you want to write if ($foo) or $foo ? use if(!empty($foo)). c) if (count($foo)) and if (sizeof($foo)) are much slower than if (!empty($foo)) empty and isset are the same speed and do not throw notices. if something is not set or NULL, then isset is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then empty is TRUE. Regards, NK
On 27.03.2007, at 17:04, Karoly Negyesi wrote:
Drupal core is now E_NOTICE free or it's supposed to be.
Amazing! Thanks a lot to everybody who helped!
a) Please file separate issues if you find any. And drop me a mail about them.
http://drupal.org/node/131483 ;) Konstantin Käfer – http://kkaefer.com/
Karoly Negyesi wrote:
empty and isset are the same speed and do not throw notices. if something is not set or NULL, then isset is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then empty is TRUE. And by TRUE he means FALSE. Or possibly !isset() or !empty(). You get the point. To be clear the following two statements are both TRUE:
If something is not set or NULL, then isset() is FALSE. if something is not set or NULL or empty array, 0 or '' or '0' then empty() is FALSE. If something is not set or NULL, then !isset() is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then !empty() is TRUE. That is all. -- Michael Favia michael@favias.org tel. 512.585.5650 http://michael.favias.org
Michael Favia wrote:
Karoly Negyesi wrote:
empty and isset are the same speed and do not throw notices. if something is not set or NULL, then isset is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then empty is TRUE. And by TRUE he means FALSE. Or possibly !isset() or !empty(). You get the point. To be clear the following two statements are both TRUE:
If something is not set or NULL, then isset() is FALSE. if something is not set or NULL or empty array, 0 or '' or '0' then empty() is FALSE. If something is not set or NULL, then !isset() is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then !empty() is TRUE.
That is all.
Hah, and by FALSE, you mean TRUE ;) isset() cannot be FALSE the same time empty() is FALSE, which is what you have written above... Look here for extended information: http://www.blueshoes.org/en/developer/php_cheat_sheet/ Gabor
Gabor Hojtsy wrote:
Michael Favia wrote:
Karoly Negyesi wrote:
empty and isset are the same speed and do not throw notices. if something is not set or NULL, then isset is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then empty is TRUE. And by TRUE he means FALSE. Or possibly !isset() or !empty(). You get the point. To be clear the following two statements are both TRUE:
If something is not set or NULL, then isset() is FALSE. if something is not set or NULL or empty array, 0 or '' or '0' then empty() is FALSE. If something is not set or NULL, then !isset() is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then !empty() is TRUE.
That is all.
Hah, and by FALSE, you mean TRUE ;) isset() cannot be FALSE the same time empty() is FALSE, which is what you have written above... Doh! Thats what I get for copy, paste, editing and not typing the silly thing out. Anyone know of a good email client with a built in php debugger? ;) Yes, my mistake please defer to that cheat sheet which basically says the above (if you switch my last booleans in each statement) in a much more coherent way.
-- Michael Favia michael@favias.org tel. 512.585.5650 http://michael.favias.org
On Mar 27, 2007, at 1:02 PM, Gabor Hojtsy wrote:
Michael Favia wrote:
Karoly Negyesi wrote:
empty and isset are the same speed and do not throw notices. if something is not set or NULL, then isset is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then empty is TRUE. And by TRUE he means FALSE. Or possibly !isset() or !empty(). You get the point. To be clear the following two statements are both TRUE: If something is not set or NULL, then isset() is FALSE. if something is not set or NULL or empty array, 0 or '' or '0' then empty() is FALSE. If something is not set or NULL, then !isset() is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then ! empty() is TRUE. That is all.
Hah, and by FALSE, you mean TRUE ;) isset() cannot be FALSE the same time empty() is FALSE, which is what you have written above...
... except when '' actually isn't empty [1], [2]. [1] http://lists.drupal.org/archives/support/2007-03/msg00074.html [2] http://drupal.org/node/128778 -- Ray Zimmerman Senior Research Associate 428-B Phillips Hall, Cornell University, Ithaca, NY 14853 phone: (607) 255-9645
On 3/27/07, Karoly Negyesi <karoly@negyesi.net> wrote:
b) Do not introduce notices with your patches. If you want to write if ($foo) or $foo ? use if(!empty($foo)). c) if (count($foo)) and if (sizeof($foo)) are much slower than if (!empty($foo))
empty and isset are the same speed and do not throw notices. if something is not set or NULL, then isset is TRUE. if something is not set or NULL or empty array, 0 or '' or '0' then empty is TRUE.
My favorite reference for PHP's comparison madness is at http://www.php.net/manual/en/types.comparisons.php. -- Neil Drumm http://delocalizedham.com
participants (6)
-
Gabor Hojtsy -
Karoly Negyesi -
Konstantin Käfer -
Michael Favia -
Neil Drumm -
Ray Zimmerman