Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109086 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83858 invoked from network); 17 Mar 2020 03:04:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Mar 2020 03:04:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7735A1804E6 for ; Mon, 16 Mar 2020 18:27:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 16 Mar 2020 18:27:09 -0700 (PDT) Received: by mail-lf1-f47.google.com with SMTP id y2so982575lfe.11 for ; Mon, 16 Mar 2020 18:27:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2k3npOn65GmrNAEsgOr0ag9ioOaqJwDD7/6BEfCiQPE=; b=emdN39Ir8rC6XOQU3MC0GgdqyJ7YZN4CE6iZaMsIHokVRGGrqvlaLPnTzNEaEstPE1 gHMS4SmQ0r/AZBA9wgHMWwRvz2aPsanyGur6vjbUBqy2z102BTGWFmBlVSLan/+eSwef U4sWhYJjTHqmV8Rc5aAbNTQkDXmii+nr9KWWazeb4iO9DvOOu2ZWKVt1WXLv6F+uetdR ya4KWrkFAHg/BNwglV3I0PcAjo5dhnUuv5LxZZ/VkExOrvYJfr0tUgHZzVZE2qsk2zXY jAp2Z8tIrmQTL+htGr/7SdDU4uUlGf3pE7FwAlsi8ijOr7iKXgqvYsQYgtMEPGLqNJQZ 4jcg== X-Gm-Message-State: ANhLgQ2PKbir2OpGVV0WMSo3Z71L2kSZ/ZHqCb6AQyXYVabrczizSmLR IqsYPiD12FtpZwhP0M6nNOeM0q1nGfoHi00Dtwg= X-Google-Smtp-Source: ADFU+vuD2StOxwOeD53mPXUfOg0TExcgTKEqap098k1ExyxZ2ltcqOPOTqFt05jLLb5SR7VexqwnWE3AaenQlt/sG7Q= X-Received: by 2002:a19:6e0f:: with SMTP id j15mr1292379lfc.76.1584408427983; Mon, 16 Mar 2020 18:27:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 16 Mar 2020 20:26:57 -0500 Message-ID: To: Marco Pivetta Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Compact Object Property Assignment From: jakob@givoni.dk (Jakob Givoni) On Mon, Mar 16, 2020 at 9:31 AM Marco Pivetta wrote: > What happens if you have an expression that throws? > > class Foo > { > public $a; > public $b; > public $c; > } > > $instance = new Foo(); > > function iThrow() { > throw new \Exception(); > } > > try { > $foo ->[ > a = 'a', > b = iThrow(), > c = 'c', > ]; > } catch (\Throwable $e) { > var_export($foo); // ??? > } Hi Marco! Trivial question - let's see what happens: Just replace COPA with the old syntax and run it: try { $foo->a = 'a'; $foo->b = iThrow(); $foo->x = 'c'; } catch (\Throwable $e) { var_export($foo); // ??? } Result: Foo::__set_state(array( 'a' => 'a', 'b' => NULL, 'c' => NULL, )) So the first property will be set, the rest will be left as they were. Best, Jakob