Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120917 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76659 invoked from network); 18 Aug 2023 15:27:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Aug 2023 15:27:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6DB041804C9 for ; Fri, 18 Aug 2023 08:27:45 -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=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 18 Aug 2023 08:27:44 -0700 (PDT) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1bee82fad0fso7877955ad.2 for ; Fri, 18 Aug 2023 08:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692372464; x=1692977264; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=/+A3oBMz0bavbbAKeNzIek4id2M3BWUJ9B61NY5EtdE=; b=Oj4DG5O6ofOM9UAPl+o5LnZjJGhphWE6LDMvUqlGbSQUYzn1wtKXfm+6Ft3WZK7Zze KW3DIHSIvdRqPd30YSsoVJgHdRkFkZB65wzEsRpHaT2K/mVJEF/rXTo75Ygg8XIA0fc6 LeRAR03fonbqrbSuroYBSKx+HaIbqNc64NWBbrxMcmcTBucEAJOCKM9R4G2WbTHr+hYE qxPDhbmnEK/JEPUzPpocbxNREvTxfF3r0W8otiG/Byo/w9h0yZHipN0alpmUuquVxTQ+ muAUw/CM+ccqQsqbn2LWQdOAPhX5fNQ9gW6MNi7HPJ+LBWv/EU9lbdWlb/IePf6GIrve eXog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692372464; x=1692977264; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/+A3oBMz0bavbbAKeNzIek4id2M3BWUJ9B61NY5EtdE=; b=e72Q4HrVfHcdzjVqkJtCU8okZRblc/dka5GPKbtySLTK0aTP1NSmRVOI3+DtEPMh1d FSIFIuXymJypjAUZojNp3YqB346iEi7wyXG1ZNMgTzwEmIPrY0SSN5pfNIgpGutyw+QQ xx2DKWGtWJhgdJSiqRrHv16WSBm28pEW+oOMFdyB2qPr2dr1pTNB2YmeP0lXcYiPY/QT wojq//g5iOe5Miq/rv6jWe0bSF1v6X2M1dYGK70LDQtrHD2zfo368XJIaaefJkNbI8DF UoXY3TCQEzLChlFL/PnQz1bnT0Q2yAizEoLMsrSIUh8envnEYNN9Fxu1Zvnc2/FCFx+c DEWQ== X-Gm-Message-State: AOJu0YzUZDIXjbYCxfTdJKq580iv1voGRDr0hwWNYLj/dc+mbPMnIAWP X4aptVB7gvH6p1vjDmXW2CuzSdUPsSSyXWeUFwgjt3bD8Rw= X-Google-Smtp-Source: AGHT+IHJ8RNodqNVFZek/mO9WGLu8RJLlnPeOIdrMU9OwCjmNxhUMwli/NoorP1O2fARUBO5wrsG9b1853OMYM7X6BE= X-Received: by 2002:a17:90a:7409:b0:268:553f:1938 with SMTP id a9-20020a17090a740900b00268553f1938mr2767996pjg.4.1692372463601; Fri, 18 Aug 2023 08:27:43 -0700 (PDT) MIME-Version: 1.0 Date: Fri, 18 Aug 2023 17:27:32 +0200 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Access property of object stored in a constant From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi everyone Since https://wiki.php.net/rfc/new_in_initializers we can store objects in global constants. However, we may not actually read or write to the properties of those objects without first fetching the constant into a local variable. const a = new stdClass; a->b = 42; // Fatal error: Cannot use temporary expression in write context $a = a; $a->b = 42; // Works fine This issue was reported twice, so it seems like this code is generally expected to work. https://github.com/php/php-src/issues/10497 https://github.com/php/php-src/issues/11781 I have created a patch here to add support for this syntax: https://github.com/php/php-src/pull/11788 Since this is a language change I would like to ask for feedback before merging. As always, if there are concerns I will create a small RFC instead. I will also only merge this for 8.4, as feature freeze for 8.3 has long passed. Ilija