Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84640 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80068 invoked from network); 12 Mar 2015 15:10:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2015 15:10:33 -0000 X-Host-Fingerprint: 194.166.179.101 194-166-179-101.adsl.highway.telekom.at Received: from [194.166.179.101] ([194.166.179.101:23827] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/60-12260-86CA1055 for ; Thu, 12 Mar 2015 10:10:33 -0500 Message-ID: To: internals@lists.php.net Date: Thu, 12 Mar 2015 16:10:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 References: <6D.2C.32765.10EC0055@pb1.pair.com> <5501759A.3010403@googlemail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Posted-By: 194.166.179.101 Subject: Re: [PHP-DEV] static constructor From: mail@deroetzi.de (Johannes Ott) Am 12.03.2015 um 12:40 schrieb Niklas Keller: > > How would it behave for the second call? If the first initialize fails due > to some exception, should that static constructor be executed again? > I think there a two different solutions and I do not know which one I prefer at the moment: 1. No second call can raise an fatal. 2. Yes should be executed again As an internal implementation, we can do a flag which is at creation time of class false and set after sucessful run of the static constructor to true. Do avoid deadlocks in loops like in the example maybe we can implement a combination of both solutions. We can implement the flag not as a boolean but as an integer counter. Raising a FATAL after X retries. Regards, -- DerOetzi