Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62582 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58878 invoked from network); 29 Aug 2012 18:53:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2012 18:53:02 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:60476] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/E3-37500-C056E305 for ; Wed, 29 Aug 2012 14:53:01 -0400 Received: by lahl5 with SMTP id l5so963858lah.29 for ; Wed, 29 Aug 2012 11:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=US9wZnWznRp84GxhM3ACAXk3xU8PZb5R+s026qxfaK4=; b=zkfmnPpnHvxiscV1ocenHo2+clfYMEBF2XRJPKpRAQUJbyIISMyrlof8nxkv70DYEf Ntvpc2XrpHzTDeKrZJjwMr/jb+iOtSkXqikAZBQMKX+b8yottm7oLgrCQcqjuXmlw2OV wfeojkEZXyuieeJBVgSn+1xkImol5SC/WN2L61USHO7kyOp25B+4JgRXpW13WGj1wskR FCEGqnzFr1ccL8P2Q+xwFwEDFeRhCn57Iat7FVX6dtsyZ0vn0oaN7FdVo576NK+1ISP2 7V9P0FEA7b3XUYgObMYm/Isl0D0Df/BOarx61GtpVKxEyGzCs5FRVqgSkd8lC+Zc+Bt6 s64g== MIME-Version: 1.0 Received: by 10.112.43.137 with SMTP id w9mr548808lbl.134.1346266377479; Wed, 29 Aug 2012 11:52:57 -0700 (PDT) Received: by 10.152.108.145 with HTTP; Wed, 29 Aug 2012 11:52:57 -0700 (PDT) In-Reply-To: <20120829162147.QQCM24459.aamtaout04-winn.ispmail.ntl.com@p2> References: <20120829162147.QQCM24459.aamtaout04-winn.ispmail.ntl.com@p2> Date: Wed, 29 Aug 2012 20:52:57 +0200 Message-ID: To: Jared Williams Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [VOTE] Generators From: nikita.ppv@gmail.com (Nikita Popov) On Wed, Aug 29, 2012 at 6:21 PM, Jared Williams wrote: > > >> -----Original Message----- >> From: Nikita Popov [mailto:nikita.ppv@gmail.com] >> Sent: 25 August 2012 17:11 >> To: PHP internals >> Subject: [PHP-DEV] [VOTE] Generators >> >> Hi internals! >> >> I think the generators RFC has been discussed thoroughly >> enough by now, so I opened the vote: >> >> https://wiki.php.net/rfc/generators#vote >> >> Thanks, >> Nikita >> > > Hi, > Just discovered another seg fault. > When iterating over a generator that returns references twice it > causes a seg fault. > > function &bind(array $keys, array &$row) > { > foreach($keys as $key) > yield $key => $row[$key]; > } > > $row = []; > $it = bind(['a', 'b'], $row); > > foreach($it as $key => &$ref) > echo $key; > echo "\n"; > foreach($it as $key => &$ref) > echo $key; Thanks, this is now fixed. It'll throw an exception now, saying that you can't traverse an already closed generator. Nikita