Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129757 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id E15791A00BC for ; Thu, 15 Jan 2026 06:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1768458982; bh=tiIdWXqQeEpjjWR2wxoWyeEfSZonk3aoxDCaou4aS1U=; h=From:Date:Subject:To:From; b=Ud8GggLWbs1jrRYTZEv3kWSPTBi1HWVUu3EfShucrZalm9moa/bITe1oJRm38y+LW gQ+xPkwLdtpsRtmhJnO9M8GRqk9H42umDx6ZidvSndpwNSX9fn4Ixt59FmllGU1PCa PdEkCyLExTbm2e0MXm7DUFrQ7AVdCZ1cWrEbk/qinhbz+5R1QdoDuo2WUPBBkDvova Snk5Juf82X5s6xr62Bdo5FOYy46xSXtbtHSgzy65tOGBq/YzQ4tvxMmmJp0Z1J5rF2 97vlJ07tnr9hR8VgaUDKQ4igvQZ9l8FcNUmPEe4jwpftHzaOwtDswx0frIM/5TnTQB TJCnPrDXe10Xg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ADFDD180041 for ; Thu, 15 Jan 2026 06:36:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 15 Jan 2026 06:36:21 +0000 (UTC) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-4f4cd02f915so3939151cf.1 for ; Wed, 14 Jan 2026 22:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768458975; x=1769063775; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=gsBiA6Ab/M3tR9KTe2cpKy4JJCddl8N9FVjLHopSEVs=; b=eReGNLNpL50KhQbMTqN5pKLoiUY97uT/F+QTqYzKkgJpDcWhdMMB+rtOAIXV7ZcRf9 ufkcMqr4TQ/CAFgyvNbx7+q3Pmvbq406dxfWnwaG3gGWxYvPNRTSxxt3bJVTJpBFljY9 IK1D7y3eUqz3NKzQ4rLhlZONK/VfUmCXNwj9NNly8nEb3hGAIrkrrrex64Zhq2pJZtT+ Csraezvid6XSQ8C4S9fJEjS0e3/krINVDcYw8F2G3I6zlmOJSHrYvxA4/krvPdgjgopy z/Gq//LBaE45DXM2wPHPvxCltSf5/eCJtk7dn9MVKqjtjAKDBxftMVEzKhS3BZ6BQ/p+ n59g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768458975; x=1769063775; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gsBiA6Ab/M3tR9KTe2cpKy4JJCddl8N9FVjLHopSEVs=; b=Tt0RmEH1hkyERPmCX8XN78p/SBGY4TvPEWNjIfpWccl0hwDvEYb0Q7evErvmvcM4ge WNrX401aY3JXN1QrG2V8i8ySUVfotW09JzgkgqHPqmJxz7TTRuV0rEzQPu+peL8aAhCv 21jME6KrF31rfKA3AwbaJZoQJWKfwKJ3NQBimzaJjRIm8P/RKTtqIotynKDg2zlroPUs JJjqfdN/HHrAU1J58+u4F9wynOvrvpZv0Q0LFmoTjuGGfd+m/mZVHKTTJbWUcwaMTHJU 891QRkBnPAZYdbZ0Do0XZTrdrJG44ILPBq3rbLEdshj2PD/HIBeYIVQBdhqssvEUN3Io I09g== X-Gm-Message-State: AOJu0YzH4ML9iYCWegEnv7pWMKrAzKhZ4C+0eVLzzMDfd2O7OXvAQV33 KUG2kTa+PEuAWIQsIPKpoIsUCh7DCM8tfnGdY+bWwzwVkToFrUlIcrtBu3HPESNDizqG18fii5c onzs2RGKJp3gNW9P+LpysnORiAJCXMqGzgZPweUn+RbR0QHg= X-Gm-Gg: AY/fxX6rC2gL2X4Ashviwbq0VKVmgUrDVfl7ZPnA/eoEYeTyT2hWXT/5LeGXMIRyC1f 2lYw6g05epujs5jlp0p76QeQwvMMFkdR2oRPH8mvo43ut/BXgs5AqV3mA+Rr3SruFiuAOWa7X5y /rvCibrrW2zoErWgtLapAnwa2zId3rBMUx253zYKXu1OxFdWiukZKGcriPFRabUTaN4HBh8Uvso VFfQZo6XXu8PTgeunx0bCaCnS2DUog8WxFvy5eIWWPsALvOseB6IIo6ECGg6ro/dN4ELL+RyYDb NLucisl4 X-Received: by 2002:a05:622a:53c8:b0:501:4703:3b6a with SMTP id d75a77b69052e-501481dc930mr65387411cf.9.1768458975326; Wed, 14 Jan 2026 22:36:15 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 15 Jan 2026 10:36:03 +0400 X-Gm-Features: AZwV_QgVJtZF3CTmCxj-cBRiSdEL8z_4seb7E5DrPdaJSBEWaVS99ES_3K0UkV4 Message-ID: Subject: [PHP-DEV] [php-src] PR #20903: GH-10497 (const obj->prop write) - language change notes To: PHP internals Content-Type: multipart/alternative; boundary="00000000000006358a064867719b" From: khaledalam.net@gmail.com (Khaled Alam) --00000000000006358a064867719b Content-Type: text/plain; charset="UTF-8" Hi internals, I opened PR #20903 to address GH-10497 by allowing writes to properties of objects referenced by consts (const binding stays immutable, referenced objects can be mutable). class C { public int $x = 0; } const OBJ = new C(); OBJ->x = 1; // currently rejected, PR makes it valid var_dump(OBJ->x); // 1 Notes: - This is a language/semantics change and may overlap with / impact GH-13800 . - A potentially surprising case: some newly-valid writes can be a no-op when they target a temporary const value, e.g. - const X = [1,2,3]; X[] = 4; - const Y = ['a' => 1]; Y['b'] = 2; These become valid syntax but have no effect because the write happens on a temporary basis. Feedback on semantics + expected behavior for the temporary-write case is appreciated. Thanks, __ *Khaled Alam* --00000000000006358a064867719b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi internals,

I opened PR #20903 to address GH-10497 by allowing writes to prop= erties of objects referenced by consts (const binding stays immutable, refe= renced objects can be mutable).

class C { public int $x = =3D 0; } const OBJ =3D new C(); OBJ->x =3D 1; =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // currently rejected, PR makes i= t valid var_dump(OBJ->x);=C2=A0 =C2= =A0 // 1

Notes:

<= /font>

  • This is a language/semantics chan= ge and may overlap with / impact GH-13800.

  • A potent= ially surprising case: some newly-valid writes can be a no-op when they tar= get a temporary const value, e.g.

    • const X =3D [1,2,3];=C2=A0 X[] =3D 4;
    • <= li>const Y =3D ['a= 9; =3D> 1];=C2=A0 Y['b'] =3D 2;
These becom= e valid syntax but have no effect because the write happens on a temporary = basis.

Feedback on semantics + expected beh= avior for the temporary-write case is appreciated.

Thanks,

__

Khaled Alam

<= /div>
--00000000000006358a064867719b--