Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67076 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85005 invoked from network); 12 Apr 2013 21:09:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2013 21:09:40 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.173 smtp173.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.173] ([67.192.241.173:36775] helo=smtp173.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/85-53062-21878615 for ; Fri, 12 Apr 2013 17:09:38 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp7.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id BB72225855C; Fri, 12 Apr 2013 17:09:35 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp7.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 1565925859C; Fri, 12 Apr 2013 17:09:33 -0400 (EDT) Message-ID: <5168780D.9000901@sugarcrm.com> Date: Fri, 12 Apr 2013 14:09:33 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Graham Kelly-Cohn CC: Larry Garfield , PHP internals References: <51673FD1.2010704@garfieldtech.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] OPcache optimizer improvement in PHP-5.5? From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > I don't think this is a safe optimization. In the following case it would > output 'b' and not 'a' which is the correct result: > > a.php: > define('FOO', 'a'); > include('b.php'); > ?> > > b.php: > define('FOO', 'b'); > echo FOO; > ?> > > It is certainly not likely for a constant to be defined twice but PHP > currently just issues a notice and continues with the first constant value. It's more likely than you think, especially given that on the way between define and include there could be other code doing various checks and calculations. In general, any optimization involving global context is very dangerous in PHP since the script can be run in different global contexts. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227