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
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
Hi,
So PHP uses HashTable to store variables like $_POST,
From a HashTable structure, can I get the array name?
No, a zval (which might point to a hash tale) doesn't refer to a name.
For one there in 99.99% is no need but it would cost memory(and CPU
cycles to maintain) and then there miht e multiple nae (references) or
none (temporaries etc.)
If you know the parent such hacks like
might work, but even this solution is flawed: The easy thing it doesn't
support is references, it should return an array of all names. It won't
work for complex things, though.
If you need such a functionality I'd suggest to take a step back and
think what you actually want to do ... usually there is a better
solution.
johannes
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?
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 4D33https://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
Please ignore that, it's badly formatted, see this one instead
https://gist.github.com/CaledoniaProject/2c2871b5fa36ab6a93e4#file-php-test-inner
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?
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 4D33https://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