Re: Seg fault when using active_symbol_table called fromuserspace function.
| From: | Mark Skilbeck | Date: | Mon, 02 Nov 2009 15:07:30 +0000 |
| Subject: | Re: Seg fault when using active_symbol_table called fromuserspace function. | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-45938@lists.php.net to get a copy of this message | ||
Mark Skilbeck wrote:
Scott MacVicar wrote:Anyone?On 1 Nov 2009, at 21:41, Mark Skilbeck wrote:Yes, that works. Do you know why we have to rebuild it? I'd assume that the symbol table was built automatically?Scott MacVicar wrote:You probably want the following to build the symbol table.On 1 Nov 2009, at 21:09, Mark Skilbeck <markskilbeck@gmail.com> wrote:Hi, Scott. I'm having trouble - I added the check to see if the symbol table i available, yet it returns false even if I have added variables within the function: [code] PHP_FUNCTION(sample_var_a_exists) {[snip]There is no symbol table as there are no variables. You should check if it's NULL before using zend_hash_exists. Scottif (!EG(active_symbol_table) || !zend_hash_exists(EG(active_symbol_table), "a", sizeof("a"))) { RETURN_BOOL(0); } RETURN_BOOL(1);} [/code] [code] $a = ''; var_dump(sample_var_a_exists()); function x() {$a = ''; // Add a symbol to the hash table. var_dump(sample_var_a_exists()); // Shows bool(false)} x(); [/code] --if (!EG(active_symbol_table)) { zend_rebuild_symbol_table(TSRMLS_C); }Scott