Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14255 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56336 invoked by uid 1010); 1 Jan 2005 05:22:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56307 invoked by uid 1007); 1 Jan 2005 05:22:50 -0000 Message-ID: <20050101052250.56306.qmail@pb1.pair.com> To: internals@lists.php.net Date: Sat, 01 Jan 2005 00:22:46 -0500 User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 66.65.38.153 Subject: possible bug with static variables? From: cellog@php.net (Greg Beaver) Hi, I have discovered some odd behavior with static variables, and wonder if it is a bug. In both PHP4 and PHP5, the code below prints: not registered, class pear_common not registered, class archive_tar I.e., because the PEAR function is called with $this->PEAR(), the static variable is reset as if the PEAR() function were re-defined! Is this expected behavior? I was under the impression that static declared a per-class static variable. PEAR(); } function _PEAR_Common() { } } class Archive_Tar extends PEAR { function Archive_Tar() { $this->PEAR(); } function _Archive_Tar() { } } $a = &new PEAR; $b = &new PEAR_Common; $c = &new Archive_Tar; ?>