Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45932 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49970 invoked from network); 1 Nov 2009 23:15:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Nov 2009 23:15:51 -0000 X-Host-Fingerprint: 86.137.226.219 host86-137-226-219.range86-137.btcentralplus.com Received: from [86.137.226.219] ([86.137.226.219:29920] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B8/65-17998-6A61EEA4 for ; Sun, 01 Nov 2009 18:15:51 -0500 Message-ID: To: internals@lists.php.net Date: Sun, 01 Nov 2009 23:15:38 +0000 User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 References: <61.F1.17998.729FDEA4@pb1.pair.com> <6DD028A4-862E-4E8A-9DE1-10EE4DBEC613@macvicar.net> In-Reply-To: <6DD028A4-862E-4E8A-9DE1-10EE4DBEC613@macvicar.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 86.137.226.219 Subject: Re: [PHP-DEV] Seg fault when using active_symbol_table called from userspace function. From: markskilbeck@gmail.com (Mark Skilbeck) Scott MacVicar wrote: > On 1 Nov 2009, at 21:41, Mark Skilbeck wrote: > >> Scott MacVicar wrote: >>> On 1 Nov 2009, at 21:09, Mark Skilbeck wrote: >>>> [snip] >>> There is no symbol table as there are no variables. You should check >>> if it's NULL before using zend_hash_exists. >>> Scott >> >> 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) >> { >> if (!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] >> >> -- > > You probably want the following to build the symbol table. > > if (!EG(active_symbol_table)) { > zend_rebuild_symbol_table(TSRMLS_C); > } > > Scott > Yes, that works. Do you know why we have to rebuild it? I'd assume that the symbol table was built automatically?