Re: Seg fault when using active_symbol_table called from userspace function.

From: Date: Sun, 01 Nov 2009 21:21:14 +0000
Subject: Re: Seg fault when using active_symbol_table called from userspace function.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-45928@lists.php.net to get a copy of this message
On 1 Nov 2009, at 21:09, Mark Skilbeck <markskilbeck@gmail.com> wrote:
Can you explain to me why the following causes a segfault: [code] PHP_FUNCTION(sample_var_a_exists) { if (!zend_hash_exists(EG(active_symbol_table), "a", sizeof("a"))) {
       RETURN_BOOL(0);
} RETURN_BOOL(1); } [/code] Note: the segfault only occurs when the sample_var_a_exists function is called from within a userspace function: [code] $a = ''; var_dump(sample_var_a_exists()); // bool(true) function x() { var_dump(sample_var_a_exists()); // segmentation fault } x()
There is no symbol table as there are no variables. You should check if it's NULL before using zend_hash_exists. Scott

« previous php.internals (#45928) next »