[SOLVED] Re: [PHP-DEV] Is it possible to get the variable name from the HashTable structure?

From: Date: Mon, 05 May 2014 05:22:29 +0000
Subject: [SOLVED] Re: [PHP-DEV] Is it possible to get the variable name from the HashTable structure?
Groups: php.internals 
Request: Send a blank email to internals+get-73882@lists.php.net to get a copy of this message
Never mind, just solved the problem. Clearly I should be comparing the ht with Z_ARRVAL instead ;-P On Mon, May 5, 2014 at 11:48 AM, Aaron Lewis <the.warl0ck.1989@gmail.com> wrote: > Please ignore that, it's badly formatted, see this one instead > > > https://gist.github.com/CaledoniaProject/2c2871b5fa36ab6a93e4#file-php-test-inner > > On Mon, May 5, 2014 at 11:45 AM, Aaron Lewis <the.warl0ck.1989@gmail.com> wrote: >> 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 <pthreads@pthreads.org> 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 > > > > -- > Best Regards, > Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/ > Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33 -- Best Regards, Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/ Finger Print: 9F67 391B B770 8FF6 99DC D92D 87F6 2602 1371 4D33

« previous php.internals (#73882) next »