Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19711 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43190 invoked by uid 1010); 24 Oct 2005 22:49:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43175 invoked from network); 24 Oct 2005 22:49:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2005 22:49:45 -0000 X-Host-Fingerprint: 195.197.172.115 gw01.mail.saunalahti.fi Linux 2.4/2.6 Received: from ([195.197.172.115:37422] helo=gw01.mail.saunalahti.fi) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 64/CA-22886-7056D534 for ; Mon, 24 Oct 2005 18:49:43 -0400 Received: from nest.netphobia.fi (YZDCXXXI.dsl.saunalahti.fi [85.76.35.232]) by gw01.mail.saunalahti.fi (Postfix) with ESMTP id EBB9FF7F18; Tue, 25 Oct 2005 01:49:37 +0300 (EEST) Received: from nest.netphobia.fi (nest.netphobia.fi [127.0.0.1]) by nest.netphobia.fi (8.13.1/8.13.1) with ESMTP id j9OMneVo019559; Tue, 25 Oct 2005 01:49:40 +0300 Received: from localhost (jani@localhost) by nest.netphobia.fi (8.13.1/8.13.1/Submit) with ESMTP id j9OMneCS019556; Tue, 25 Oct 2005 01:49:40 +0300 X-Authentication-Warning: nest.netphobia.fi: jani owned process doing -bs Date: Tue, 25 Oct 2005 01:49:40 +0300 (EEST) Reply-To: Jani Taskinen To: Marcus Boerger cc: internals@lists.php.net In-Reply-To: <425333877.20051025002259@marcus-boerger.de> Message-ID: References: <425333877.20051025002259@marcus-boerger.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Re: [PHP-DEV] foreach with null From: sniper@iki.fi (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 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 > > -- Give me your money at @ Donating money may make me happier and friendlier for a limited period! Death to all 4 letter abbreviations starting with P!