Re: Is it possible to get the variable name from the HashTable structure?
| From: | Aaron Lewis | Date: | Mon, 05 May 2014 03:45:45 +0000 |
| Subject: | Re: Is it possible to get the variable name from the HashTable structure? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73880@lists.php.net to get a copy of this message | ||
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