Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40183 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62331 invoked from network); 31 Aug 2008 09:47:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Aug 2008 09:47:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.235.152.153 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.235.152.153 mail963c35.nsolutionszone.com Linux 2.5 (sometimes 2.4) (4) Received: from [209.235.152.153] ([209.235.152.153:57494] helo=mail963c35.nsolutionszone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/E3-27196-E986AB84 for ; Sun, 31 Aug 2008 05:47:12 -0400 X-POP-User: wilmascam.centurytel.net Received: from pc1 (72-161-146-209.dyn.centurytel.net [72.161.146.209]) by mail963c35.nsolutionszone.com (8.13.6.20060614/8.13.1) with SMTP id m7V9kxKs002741; Sun, 31 Aug 2008 09:47:01 GMT Message-ID: <008f01c90b4e$84a2dbb0$0201a8c0@pc1> To: , "Dmitry Stogov" , "Stanislav Malyshev" References: <013e01c8f257$1e1bbcf0$0201a8c0@pc1> <4890B18E.7000500@zend.com> <00e001c8f302$e8100fb0$0201a8c0@pc1> <4891A769.6090306@zend.com> <026201c909dc$46875860$0201a8c0@pc1> <48B856D9.7080906@zend.com> <48BA58BA.9090404@zend.com> Date: Sun, 31 Aug 2008 04:46:59 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1933 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933 Subject: Re: [PHP-DEV] Re: [PATCH] Constant expr folding (again), and other things From: php_lists@realplain.com ("Matt Wilmas") Hi Stas, Dmitry, I forgot to reply to Stas' message yesterday, sorry... But, there is no change in behavior here either as far as I know. For the code Stas quoted, with static vars (if that's what was being referred to), there's definitely not been a change (though its parser code was tweaked a bit), and there has never been a locale issue, and the operand negation happens at compile-time (as always). The reason there should also be no change doing +/- at compile time now (out of static_scalar context) with constant values is because locale *does not affect* string to number conversion -- only '.' works as a decimal point in is_numeric_string() (maybe zend_strtod() too; didn't look), so there's no way the conversion could be different during runtime. :-) Now for going the other way, double to string, locale is honered, I believe? In that case, Dmitry, that would be another issue trying to do the full folding (with ZEND_CONCAT), with something like $a = 'abc ' . 1.23; So good thing it's left out for now! (Hmm, don't [some] optimizers do this folding? Maybe they haven't considered the locale issue...) But anyway, I don't think there are any worries about the current code and what has been done. Thanks, Matt ----- Original Message ----- From: "Dmitry Stogov" Sent: Sunday, August 31, 2008 > Hi Stas, > > We discussed this patch with Matt, and I allowed this change. > So it probably my fault (I missed run-time locale change possibility). > I don't think it is a really big issue, but it really may change > behavior of some scripts. > I think we should revert this patch, before we get complete solution for > compile-time expression evaluation (not in 5.3 of course). > > Thanks. Dmitry. > > Stanislav Malyshev wrote: > > Hi! > > > >> static $a = -'abc'; // 0 > >> static $b = +'abc'; // abc > >> $c = +'abc'; // 0 > >> } > > > > We could get into trouble here. Imagine: > > static $a = -'12.8'; > > > > This should be -12.8, but what if locale changes and . is no longer > > decimal separator? Moreover, what if locale changes between compile and > > runtime? We get entirely different code now. > > > >> Well, I don't know if it can be tossed in quickly at this time, but > >> there ya > >> go since I think it's pretty basic! ;^) > > > > I think it's not the feature that can be "tossed in quickly" - it can > > have some obscure side effects, as I described in my later emails.