Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75149 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36729 invoked from network); 30 Jun 2014 19:06:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jun 2014 19:06:12 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.178 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.178 mail-vc0-f178.google.com Received: from [209.85.220.178] ([209.85.220.178:46584] helo=mail-vc0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/A2-19922-125B1B35 for ; Mon, 30 Jun 2014 15:06:12 -0400 Received: by mail-vc0-f178.google.com with SMTP id ij19so7973386vcb.37 for ; Mon, 30 Jun 2014 12:06:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=gHZtCl847ziMGC9DmLzXnwZEKEPxDyQ1iRt1s7Mvd9U=; b=WeK46oe1WeB568LmM3a0G/EWNFqZf3Ylq/24O0so1pELF/LR8oEDSXT583jg3RmmPT pTQbzlszz2JZ9TodCmc09nMYV90YSPuo5lafqso69VWtdjmZNleFja2RFZm2eneCKIp4 o6/mSTOG+E8/EjN7bViLVRxCr6lddnJyKqfMPSMS7C3W24ar4yltWhiGqsKPpAwmzcWK e9pqZP3xEVW8cygURV8Pp+r5Ewca9C7cM56rsaYSPYO9cui4/wrQcb5OjDCk0sxBOmWc NltJcJz42tIq+edFbMDg/l10WPGLvLvaVMlfaLEQqA0H9uXWWJ9fOIK055OvA4eE30FS 3Y5Q== X-Gm-Message-State: ALoCoQkKGYELs/tlYD8S8px0/c/j//rkiwN7Nm3y1TG6xRZubpOc7HsyTPTzgq3ishTQa4YcjqClbFin3x6+3lNywffYgXNql/mr07K8ANShoSrgHdrynCrjcb7z3sLm+JJVO6dvqIsF MIME-Version: 1.0 X-Received: by 10.58.152.234 with SMTP id vb10mr39887975veb.21.1404155166899; Mon, 30 Jun 2014 12:06:06 -0700 (PDT) Received: by 10.52.111.71 with HTTP; Mon, 30 Jun 2014 12:06:06 -0700 (PDT) Date: Mon, 30 Jun 2014 23:06:06 +0400 Message-ID: To: Bob Weinand Cc: Xinchen Hui , David Soria Parra , Julien Pauli , PHP Internals Content-Type: multipart/alternative; boundary=089e0122f736eee10d04fd125902 Subject: Wired constant expression syntax and bug From: dmitry@zend.com (Dmitry Stogov) --089e0122f736eee10d04fd125902 Content-Type: text/plain; charset=UTF-8 Hi Bob, I'm wondered why you introduced this wired syntax in PHP-5.6. class FooBar { const bar = ["bar" => 3]["bar"]; } It wasn't a part of RFC, it wasn't covered by tests, and it actually doesn't make a lot of sense. May be it's better to remove it? Also I found a constant expression related bug, that leads to unpredictable crashes from time to time. Previously we had IS_CONSTANT_ARRAY that was handled in a special way. When you replaced it with IS_ARRAY, you missed this handling, and I missed it as well when reviewed your patch. Now IS_ARRAY constants might be incompletely copied from OPCache shared memory and modified (incremented/decremented reference counter) directly in SHM. Such modifications occur in simultaneously running processes and this finally leads to crash on some race condition. It's possible to emulate the problem running the following script with opcache.protect_memory=1 I propose a simple fix: https://gist.github.com/dstogov/b73884e252b376957ebc Please review and apply if agree. Thanks. Dmitry. --089e0122f736eee10d04fd125902--