Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19708 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36339 invoked by uid 1010); 24 Oct 2005 22:23:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36324 invoked from network); 24 Oct 2005 22:23:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2005 22:23:01 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:47215] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A7/F9-22886-4CE5D534 for ; Mon, 24 Oct 2005 18:23:00 -0400 Received: from [192.168.1.3] (dslb-084-063-017-147.pools.arcor-ip.net [84.63.17.147]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 32A2135C384 for ; Tue, 25 Oct 2005 00:25:54 +0200 (CEST) Date: Tue, 25 Oct 2005 00:22:59 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <425333877.20051025002259@marcus-boerger.de> To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: foreach with null From: helly@php.net (Marcus Boerger) Hello internals, i would like to change foreach a tiny bit. Actually i don't like the warning when using foreach with null. marcus@zaphod /usr/src/php-cvs $ php -r '$n=NULL; foreach($n as $v);' make: `sapi/cli/php' is up to date. Warning: Invalid argument supplied for foreach() in Command line code on line 1 marcus@zaphod /usr/src/php-cvs $ php -r 'foreach(NULL as $v);' make: `sapi/cli/php' is up to date. Warning: Invalid argument supplied for foreach() in Command line code on line 1 The way we use NULL in PHP should result in no warning here. The patch for this can be found here: http://php.net/~helly/php/ext/ze2/ze2-foreach-null-20051025.diff.txt It was made with head but applies to 5.1 as well. Any opinions? Best regards, Marcus