Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45938 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61706 invoked from network); 2 Nov 2009 15:07:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Nov 2009 15:07:42 -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:27972] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/A8-16627-CB5FEEA4 for ; Mon, 02 Nov 2009 10:07:41 -0500 Message-ID: <10.A8.16627.CB5FEEA4@pb1.pair.com> To: internals@lists.php.net Date: Mon, 02 Nov 2009 15:07:30 +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: 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 fromuserspace function. From: markskilbeck@gmail.com (Mark Skilbeck) Mark Skilbeck wrote: > 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? Anyone?