Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120918 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 936 invoked from network); 19 Aug 2023 00:18:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Aug 2023 00:18:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1B4601804BC for ; Fri, 18 Aug 2023 17:18:43 -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.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL, STOX_BOUND_090909_B,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS36483 23.83.208.0/21 X-Spam-Virus: No X-Envelope-From: Received: from dog.birch.relay.mailchannels.net (dog.birch.relay.mailchannels.net [23.83.209.48]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 18 Aug 2023 17:18:41 -0700 (PDT) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id EC274100ED5 for ; Sat, 19 Aug 2023 00:18:40 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id AE6C7100771 for ; Sat, 19 Aug 2023 00:18:39 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1692404320; a=rsa-sha256; cv=none; b=5KUWst3B9RVz69atY3/lw13SJQiWtxWMJ/uH4ImjW1vfTkzej7bhlFDhoydHcu05oCKiQv VHYuixXQ+RGHbOFi2oEpDtcorOOrjFAWtI7ex+cKYzzgu69PbD4Z+tq/xbfNhgvw/V9LBO 6gY5ZddwKGOO+UkNkMY3W51RJvj2uhhKP1/op4bd9VA9bbG5wRRW81JBi/UYZF+Dyb2vFv US2Jr5VI4m0+igF/tEpzwDlcTiWrvOlreZZB5dIrR42KowMEcYWNFj92a9ga4c/ytuAZoJ FluiWjo7ABYyzMZjhtYGAv2fXLfb82CPEywvORWHmQGp0oCDRXB7mQLj/zgkng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1692404320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hcphAkeXs2OWh4DUYF6884wzZ7nFqYQdqRaz8A6oHpw=; b=Dmfv2PSsSvz2sSbyrNy36T09hcQM85wv29SZvEOnH1RPAtNHmvMZDxkD8B+p8kucYYyHNp 57ffNycwH3M75joAcYTcCNVQ7+2oskrhG0TWNK2w3LWZKXgbFGbFFpiZufDhMOrHvCzIFD 2e4mHiSYik8+VCrJb2/FslGFXxMzRFbl+kpLY5X0GrLP0ucD9UCAh9reizt9WQvzS3wqAZ qf+Pz/pFT7WQZPojxdxxDcpFklHZC4bELMulbcjqu9CYlKTPGwAvcqFkMqV0q/rtOWpiE3 kjb+E5inHFWiuZRGes+Ho8qX2GKdzk4AHJEWi6K9aowaEWXMfT2vigHk8rWXDg== ARC-Authentication-Results: i=1; rspamd-749bd77c9c-4tqgb; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Befitting-Tasty: 36b15b1a77686339_1692404320300_969106595 X-MC-Loop-Signature: 1692404320300:369646444 X-MC-Ingress-Time: 1692404320299 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.250.38 (trex/6.9.1); Sat, 19 Aug 2023 00:18:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hcphAkeXs2OWh4DUYF6884wzZ7nFqYQdqRaz8A6oHpw=; b=Xm5w/1VB6UgoBwHoylJYboMndD IDpqJPP42w0kdhjR8UCHD4BI6YM7+mlqEGrOiKxax/Dtx/GSVXL3HdtwjK1KEtkpbOBQatInD8VRk +9MHxpKR1pjsMi1cgNEJUuK5RaN1kMiXeUkuE7XrWRrXesw24a2PvtDfXC/9sGTplgxI=; Received: from [143.178.154.86] (port=50584 helo=[192.168.1.16]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1qX9fq-00Ba02-2o for internals@lists.php.net; Sat, 19 Aug 2023 02:18:37 +0200 To: internals@lists.php.net References: Message-ID: <64E00A5D.5010108@adviesenzo.nl> Date: Sat, 19 Aug 2023 02:18:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------050402060106020104030600" X-AuthUser: juliette@adviesenzo.nl Subject: Re: [PHP-DEV] Access property of object stored in a constant From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) --------------050402060106020104030600 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 18-8-2023 17:27, Ilija Tovilo wrote: > 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 > I totally understand that people are trying to do this, but this still very much feels like scope creep. IIRC the new in initializers feature was _intended_ only for enums (which can't take properties). Now suddenly a "constant" would no longer be constant... In which case, what's the point of declaring it as a constant ? Smile, Juliette --------------050402060106020104030600--