Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73880 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54774 invoked from network); 5 May 2014 03:45:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 May 2014 03:45:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=the.warl0ck.1989@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=the.warl0ck.1989@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.42 as permitted sender) X-PHP-List-Original-Sender: the.warl0ck.1989@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:47904] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/C1-22971-C6907635 for ; Sun, 04 May 2014 23:45:48 -0400 Received: by mail-oa0-f42.google.com with SMTP id j17so3453694oag.15 for ; Sun, 04 May 2014 20:45:45 -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=WETZ9fevP+Gt1uF29UxYjgDdxahH3nxbKkQBLJ8tALc=; b=n5zerDmjx2IiPP42c/ar9A+8wDdhk0ay4hjtqs2nRMto+mxSSy6ZRCmOTBttoHn9FM HXSSZv1QsHdeCaoSnirK2BdCuqSHBMIyf7Aq4AJucwxMdevTzPd+2cemvfynku9dCMz8 WwCglFmO2X67dfKxxYX93zVn9wDk38Ri9pX67ZlP6onro4dbB2eBFa5Qf66deQ1cqhPN 2P3U1P/NGP5O/I/4ndD/ajyELhp+Y4N+veznVk7bVr6qkdP7j3ld38LGdPb/BQV4HQUT e4zqI/AozQFYWB/nGr89QVpE9AZOmCvppqH+Z9edFMuU/7trJEW7Z7q9EDP+hVNlh5Zr JYpg== MIME-Version: 1.0 X-Received: by 10.182.115.232 with SMTP id jr8mr18160208obb.35.1399261545345; Sun, 04 May 2014 20:45:45 -0700 (PDT) Received: by 10.76.23.66 with HTTP; Sun, 4 May 2014 20:45:45 -0700 (PDT) In-Reply-To: <1399216437.14925.0.camel@localhost.localdomain> References: <1399216437.14925.0.camel@localhost.localdomain> Date: Mon, 5 May 2014 11:45:45 +0800 Message-ID: To: Joe Watkins Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Is it possible to get the variable name from the HashTable structure? From: the.warl0ck.1989@gmail.com (Aaron Lewis) Hi Watkins, First of all, pthreads@pthreads.org? Nice account I'm trying your patch, but in a different place In static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type TSRMLS_DC), fetch_string_dim: if (zend_hash_quick_find(ht, offset_key, offset_key_length+1, hval, (void **) &retval) == FAILURE) { ... fetch_string_dim: if (zend_hash_quick_find(ht, offset_key, offset_key_length+1, hval, (void **) &retval) == FAILURE) { switch (type) { case BP_VAR_R: printf ("(R) Undefined index %s, looking up array variable name\n", offset_key); HashPosition position; zval **test = NULL; for (zend_hash_internal_pointer_reset_ex(EG(active_symbol_table), &position); zend_hash_get_current_data_ex(EG(active_symbol_table), (void**)&test, &position) == SUCCESS; zend_hash_move_forward_ex(EG(active_symbol_table), &position)) { printf ("Comparing with: %s\n", ((Bucket*)position)->arKey); if (*test == ht) { printf ("Found variable name: %s\n", ((Bucket*)position)->arKey); // RETURN_STRINGL(((Bucket*)position)->arKey, ((Bucket*)position)->nKeyLength, 1); } } .... Hmm, I got no match ... am I wrong somewhere? On Sun, May 4, 2014 at 11:13 PM, Joe Watkins wrote: > On Sun, 2014-05-04 at 20:21 +0800, Aaron Lewis wrote: >> Hi, >> >> So PHP uses HashTable to store variables like $_POST, >> >> From a HashTable structure, can I get the array name? >> >> -- >> Best Regards, >> Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/ >> Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33 >> > > https://gist.github.com/krakjoe/50603be7ffb1ae6e9156 > > Cheers > Joe > -- Best Regards, Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/ Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33