Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91950 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96220 invoked from network); 25 Mar 2016 15:49:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2016 15:49:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.177 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.177 mail-lb0-f177.google.com Received: from [209.85.217.177] ([209.85.217.177:35585] helo=mail-lb0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/03-10214-11E55F65 for ; Fri, 25 Mar 2016 10:49:39 -0500 Received: by mail-lb0-f177.google.com with SMTP id bc4so50323362lbc.2 for ; Fri, 25 Mar 2016 08:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=/I+2EwusmDfXr6j34UV1t0+EkzDYGeBhNuvIC6tRP9k=; b=MR1JsA42EAmpSW/nT3ZlaWs5dHr32E5/z9ZeVYa1qxTt1pJSLDZOB3OWBSQZxvQ0TD EVIzttId2I58ClMC93duxQZ98CMOztkLTwtZZuKGV0BfL2EceGZ4mYrqhxkDep4VqfB4 Sq1hfeBAOXhiOJ49oziFoVU0Ioae+NIQyG2/qmHrq8EueQnrXJVAuIuavbyUWLqlUtcV rWFSTxTyQMjVo4P6MAHq+Tyu/OYFpyRe0fhU9c7w7u9nB9Giz+LLXcXHvNlyL55Mf4zI ekw1d4/DGGGwiMoFMV2sdpeUebgVHjqCTO9ccgSNBABMG78E7eT6cT1I4pqFWM8kcuDU 8NRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=/I+2EwusmDfXr6j34UV1t0+EkzDYGeBhNuvIC6tRP9k=; b=Wy92fuAUCcHKpbfPDzwmlnHXQbYDoWm+6QsJqXmwE/BV4er4RVGuoVjdy8kRhMPV0o FEx7hZBF+G2+SS8EvDRG/XtHiX5mp5k3yzPDagl77FUJ9X78q1GyyXCzl+jUNmxycvn2 mZJZuIkTxQdfGxYbySRECbSUNbvth+7yVwqw2HAKmQzmT5G4LVcclFgW/4f0jij2pD6Z qjoigs66dwbZsB07wIufgf8okEIFslBEzaMvPgXJnzzWibGfi1WKYlTzphxOV9ZiudvF R283rNoVd6lGyVYX4G96goGqcZ6xOyvzJI/9XaG4638BVkBbKlXfwkE1RIlAUO4P6b/0 9I8w== X-Gm-Message-State: AD7BkJJmlvDd5mVMgl7aDTXtb0bCeqcHvV2KBugIrr/cthbuhm0gRlE8xhnfZgr1lsjvRM5vrt/Z6Zx2b/2nSw== MIME-Version: 1.0 X-Received: by 10.112.143.163 with SMTP id sf3mr5697818lbb.117.1458920974845; Fri, 25 Mar 2016 08:49:34 -0700 (PDT) Sender: php@golemon.com Received: by 10.112.18.75 with HTTP; Fri, 25 Mar 2016 08:49:34 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: References: Date: Fri, 25 Mar 2016 08:49:34 -0700 X-Google-Sender-Auth: cdHIUjb7ZZv3bcH7x-mjXoof-80 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: [RFC] [Vote] Short Ternary Assignment Operator From: pollita@php.net (Sara Golemon) On Fri, Mar 25, 2016 at 6:44 AM, Nikita Popov wrote: > I don't think the current implementation is entirely correct. In particular, > it doesn't look memory-safe to me. You're doing an RW fetch on the LHS > first, then evaluate the RHS expression and then ASSIGN to the result of the > RW fetch. This means you're running user code between the RW fetch and the > assignment to it. The code of the RHS expression may cause a reallocation of > the buffer into which the INDIRECT points, making it a dangling pointer. > > Something like > > $a = [false]; > $a[0] ?:= ($a[''] = 42); > > will probably result in valgrinds. > Ah, good call. Back to the drawing board. :) -Sara