Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13013 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 989 invoked by uid 1010); 27 Sep 2004 16:14:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 835 invoked from network); 27 Sep 2004 16:14:45 -0000 Received: from unknown (HELO mrout2.yahoo.com) (216.145.54.172) by pb1.pair.com with SMTP; 27 Sep 2004 16:14:45 -0000 Received: from bourbon.corp.yahoo.com (bourbon.corp.yahoo.com [216.145.53.135]) by mrout2.yahoo.com (8.13.1/8.13.1/y.out) with ESMTP id i8RGEYLX041401; Mon, 27 Sep 2004 09:14:34 -0700 (PDT) Received: (from andrei@localhost) by bourbon.corp.yahoo.com (8.12.9/8.11.1) id i8RGEUNc071413; Mon, 27 Sep 2004 09:14:30 -0700 (PDT) (envelope-from andrei@gravitonic.com) X-Authentication-Warning: bourbon.corp.yahoo.com: andrei set sender to andrei@gravitonic.com using -f Date: Mon, 27 Sep 2004 09:14:30 -0700 To: Robert Silva Cc: internals@lists.php.net Message-ID: <20040927161429.GA70753@gravitonic.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Subject: Re: [PHP-DEV] Newbie help From: andrei@gravitonic.com (Andrei Zmievski) On Sun, 26 Sep 2004, Robert Silva wrote: > Trying to register a constant value for a class and it keeps crashing. > Learning C as I go, so I would appreciate some insight. I can figure out > that my *property value is lost during zend_hash_add() but my knowledge > stops there as to why. Tried passing property as property and &property. > > ZEND_METHOD(zboolean, __construct) > { > zval *object = getThis(); > zval *property > > ALLOC_ZVAL(property); > INIT_PZVAL(property); > ZVAL_STRING(property, "true", 1); > zend_hash_add(&(Z_OBJCE_P(object))->constants_table, "TrueString", > sizeof("TrueString")+1, property, sizeof(zval *)); > } zend_hash_add(&(Z_OBJECE_P(object))->constants_table, "TrueString", sizeof("TrueString"), &property, sizeof(zval *), NULL); should work. - Andrei