Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4728 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5006 invoked by uid 1010); 7 Oct 2003 13:48:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 4970 invoked from network); 7 Oct 2003 13:48:28 -0000 Received: from unknown (HELO mx.thebrainroom.net) (65.200.24.98) by pb1.pair.com with SMTP; 7 Oct 2003 13:48:28 -0000 Received: by mx.thebrainroom.net (Postfix, from userid 517) id 4DE69148808C; Tue, 7 Oct 2003 06:47:04 -0700 (PDT) Received: from zaneeb.thebrainroom.net (zaneeb.thebrainroom.net [82.133.1.138]) by mx.thebrainroom.net (Postfix) with ESMTP id 5CABD1488087; Tue, 7 Oct 2003 06:46:59 -0700 (PDT) Received: from titan (titan.thebrainroom.net [82.133.1.139]) by zaneeb.thebrainroom.net (8.11.6/8.11.6) with SMTP id h97DmNK18019; Tue, 7 Oct 2003 14:48:23 +0100 Message-ID: <022501c38cd9$a9834490$8b018552@titan> To: , Date: Tue, 7 Oct 2003 14:48:17 +0100 Organization: The Brain Room Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.0 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 X-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-TBR-Filter: Virus scanned and defanged Subject: PHP 5 foreach iterators for COM From: wez@thebrainroom.com ("Wez Furlong") I need some kind of engine hook to allow this kind of code in the COM extension: foreach ($container as $child) { echo $child->name; } The way this works in COM is like this: foreach fetches the magic iterator property from $container. The magic iterator is an instance of IEnumXXX, where XXX is most likely Variant, but could be anything. It then repeatedly calls $iterator->Next() to fetch the next item. When done, it releases the $iterator. I know Marcus implemented iterators for spl, but the concept there is that the $container itself needs to implement spl interfaces. The just doesn't fit with the way COM stuff works, and pollutes the COM object with magic (some COM objects want to handle method and property accesses by magic themselves). Can we have a extra handler in the object handlers struct that returns an object that implements an engine-supported iterator? --Wez.