Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59445 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88685 invoked from network); 7 Apr 2012 21:38:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2012 21:38:12 -0000 Authentication-Results: pb1.pair.com header.from=yader.hernandez@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yader.hernandez@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: yader.hernandez@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:58171] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/13-23111-3C3B08F4 for ; Sat, 07 Apr 2012 17:38:12 -0400 Received: by obbeh20 with SMTP id eh20so4764460obb.29 for ; Sat, 07 Apr 2012 14:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=8q3VrCdQB9JcbpxKQC3MenfkHEU3KCfXhybRdEZBqtA=; b=nTP0F2q75fgAv2ZWeVr0SI7hfiCCSGnt0pwVfdSQpFBzf3xefljJO7HOVTTIOqdkHj r1oCZr1GzA8tZyAuXM/lixVBrPuSvNvVvEVBgFadDaf8WeEiQHCawb0rnz26gFmsQpAS 5sGMLmWUpzcelK4yjxmC052imnMhtVU2jLU+jZzq9S2m7rC1XQ4QB66rpN1CXCJgnNut ZVFM7pM06YjdPudrYWZ7w09OMs7LRVzOC/FbQe+SCSYSU5qtlW9w1OqxuDDtPGv9Rvdu 20At4W4S/1QeDfv7L+0WQj2tms7CmTn7xJd0FidKXl7ncSGNeeed9TMULkE6GuO8buPm VbWQ== MIME-Version: 1.0 Received: by 10.60.4.170 with SMTP id l10mr3299014oel.67.1333834689154; Sat, 07 Apr 2012 14:38:09 -0700 (PDT) Sender: yader.hernandez@gmail.com Received: by 10.60.147.199 with HTTP; Sat, 7 Apr 2012 14:38:09 -0700 (PDT) In-Reply-To: <1333834026.4220.6.camel@guybrush> References: <1333834026.4220.6.camel@guybrush> Date: Sat, 7 Apr 2012 14:38:09 -0700 X-Google-Sender-Auth: T18p2288iPm6JrnK89IOYmB_gyI Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=e89a8fb1f862d60f2704bd1d9624 Subject: Re: [PHP-DEV] how do you create a private property as an array in a class From: proxilabs@gmail.com (Matthew Hernandez) --e89a8fb1f862d60f2704bd1d9624 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Johannes, Yes I just found out that I should extend instead of the approach I was thinking about. So I created this: typedef struct _foo_object { zend_object std; zval *array; int size; } foo_object; So the question is how do I correctly pass foo_object around so that I can manipulate *array ? Having a private variable would mean calling getThis() and handling it that way would be trivial. Are there any examples I could see? I'm using the slides from your presentation in 2009 to help me. thanks On Sat, Apr 7, 2012 at 2:27 PM, Johannes Schl=FCter wrote: > Hi, > > On Sat, 2012-04-07 at 11:23 -0700, Matthew Hernandez wrote: > > This is my first extension I'm working on. I'm trying to make a class > > available to the user space with 1 private property that is an array. > > The first question is: Why? - Why add the overhead of creating such an > array if it is private? In most cases it is better to extend the > zend_object in C (struct my_object { zend_object inner; type > some_data;}) to hold private data. If you want to show it in var_dump or > a debugger you could implement a debug_info hook. > > johannes > > > --e89a8fb1f862d60f2704bd1d9624--