0

I write a pecl function named sample_isset, and its code is :

   PHP_FUNCTION(sample_isset) {
     zval **fooval;
     if(EG(active_symbol_table) == NULL) {
             php_printf("the active symbol table is NULL");

     }else if(zend_hash_find(EG(active_symbol_table),"foo",4,
                     (void **) &fooval) == SUCCESS){
             php_printf("Got the value of $foo!");
     } else {
            php_printf("$foo is not defined!");
    }
 }

And I want to use this function to see if current symbol table has a $foo variable. When I use it in global scope, it works well. But When I use it in another function for example hello, I go a error, and see nothing . The hello function may be like this.

function hello(){
   sample_isset();
}

I don't know why I got an error.

xingyue
  • 122
  • 1
  • 9

1 Answers1

1

It seems that the php function used the lazy loading, the active_symbol_table doesn't always exist, so You should use zend_rebuild_symbol_table before EG(active_symbol_table) .

xingyue
  • 122
  • 1
  • 9