> Any opinions? Good code is code that's easy to debug (among other things). By removing the "Invalid argument supplied for foreach()" warning without providing mechanisms to turn it on, debugging code will be more difficult. Logically speaking, when does it make sense to iterate over something that isn't an array?
If I were writing one-time use scripts that I will never use again (not likely) this might be desired behavior. If I were writing code that is used by other programmers, paying users, and under conditions likely to change (implying changing code, and often debugging and testing), the ability to detect errors as early as possible is vital (The Pragmatic Programmer is a good reference for this). Most people don't want to spend more time than is necessary to troubleshoot code. Probably more importantly, managers and customers don't want to wait longer for a product they're paying for. Understandly, PHP aims to be "easy" in so many ways, but I believe in order for PHP to survive in the enterprise and allow users to easily write good code, it *must* support such features. Without features like these, writing PHP won't be so easy because the work required to do the checking is forced on the programmer. The "Invalid argument supplied for foreach()" warning should not be removed unless it can be done without breaking compatibility and with a way to optionally turn it on/off. I think we can learn a good lesson from Perl on this one. Here is how we turn on/off warnings, lexically: use warnings; - sebastian -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php