Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28972 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38805 invoked by uid 1010); 24 Apr 2007 12:21:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38790 invoked from network); 24 Apr 2007 12:21:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2007 12:21:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=tijnema@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tijnema@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.132.246 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tijnema@gmail.com X-Host-Fingerprint: 209.85.132.246 an-out-0708.google.com Received: from [209.85.132.246] ([209.85.132.246:18039] helo=an-out-0708.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/85-21560-B56FD264 for ; Tue, 24 Apr 2007 08:21:48 -0400 Received: by an-out-0708.google.com with SMTP id c28so2585897ana for ; Tue, 24 Apr 2007 05:21:45 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MK9RJuvch/0AR4PiRGxX9Gq35WfXe9reoy+KunJap868bED1GgenJJwJhoINzlVeyX6vlrh6QNXfiRalpbsY9dMmKAmKASoawg+T/vLrDTNUYYBNpuDrkGDkZJ+t+TXjZzAtNo9UpobMa+sXux/6UV8t/lRrNENryN+c1R7UwWQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dnT+aWg6VuKq1dnKlUDdatyTlFUO6ePKCDZsaNgBFTYUxMD9b5CF7ZEaH461YFe7M1QQr3DyNtssqm2nJ96aM5KIV5XIvQEwxFV/kif/9nff6arRXQSH1QYJq+41OzXuI5x+vhw/qj5Te15h8H0jQNj81cbRKHSLA/6O7FwGR1Y= Received: by 10.100.178.7 with SMTP id a7mr4509515anf.1177417304592; Tue, 24 Apr 2007 05:21:44 -0700 (PDT) Received: by 10.100.43.17 with HTTP; Tue, 24 Apr 2007 05:21:44 -0700 (PDT) Message-ID: Date: Tue, 24 Apr 2007 14:21:44 +0200 To: Ci Cc: internals@lists.php.net In-Reply-To: <2A.C4.21560.B43FD264@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <88.B2.24904.A6B3B264@pb1.pair.com> <2A.C4.21560.B43FD264@pb1.pair.com> Subject: Re: [PHP-DEV] Re: access to variables From: tijnema@gmail.com ("Tijnema !") On 4/24/07, Ci wrote: > I tried to use smth like that: > > zval *data = NULL; > > zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), > "DOCUMENT ROOT", sizeof("DOCUMENT ROOT"), &data); > strcpy(buffer, Z_STRVAL_P(data); > > Then I write the buffer to file, but I don't get correct variable. > I'm working with php-5.2.1. > > Am I in a good way to solve my problem? > > Regards, > Ci Ok, i don't know a lot about the core of PHP, but i do know the C language. First of all, i don't see you declaring buffer somewhere, i guess you did it without showing, or that it is in the core. But if it isn't both, you should do :) Also note that buffer should be declared as char *buffer to be able to use the strcpy function on it. Second, when you're using the strcpy function, you have 2 '(' used, and only one ')' I guess this is a type here. (else it would return error on compilation i guess) Third, the function strcpy also has a return value. It should be returned to a pointer to the string where it is copied to. so it would become: buffer = strcpy(buffer,Z_STRVAL_P(data)); If all above noted is correct, then it is a problem with your zend_hash_find function, but as i noted already, i don't know a lot of the PHP core, so i can't help further with it. Tijnema