Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45931 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47075 invoked from network); 1 Nov 2009 22:48:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Nov 2009 22:48:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=scott@macvicar.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=scott@macvicar.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain macvicar.net from 97.107.131.220 cause and error) X-PHP-List-Original-Sender: scott@macvicar.net X-Host-Fingerprint: 97.107.131.220 whisky.macvicar.net Linux 2.6 Received: from [97.107.131.220] ([97.107.131.220:35558] helo=whisky.macvicar.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 80/E4-17998-C301EEA4 for ; Sun, 01 Nov 2009 17:48:29 -0500 Received: from [192.168.1.103] (macvicar.demon.co.uk [80.177.111.173]) by whisky.macvicar.net (Postfix) with ESMTP id CBCC24695D; Sun, 1 Nov 2009 17:48:25 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes In-Reply-To: Date: Sun, 1 Nov 2009 22:48:24 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: 7bit Message-ID: <6DD028A4-862E-4E8A-9DE1-10EE4DBEC613@macvicar.net> References: <61.F1.17998.729FDEA4@pb1.pair.com> To: Mark Skilbeck X-Mailer: Apple Mail (2.1076) Subject: Re: [PHP-DEV] Seg fault when using active_symbol_table called from userspace function. From: scott@macvicar.net (Scott MacVicar) 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