Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115995 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 7250 invoked from network); 7 Sep 2021 13:41:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Sep 2021 13:41:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DAF2B1804C9 for ; Tue, 7 Sep 2021 07:18:48 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.0.0/20 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 ; Tue, 7 Sep 2021 07:18:48 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B03995C00D1 for ; Tue, 7 Sep 2021 10:18:47 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Tue, 07 Sep 2021 10:18:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=fgKFi+ YUnYYE44lTgX3vNwk9Peqr0rRQKhhAuNlmzj4=; b=hBefZ6wwXiNjbBx954+Vzh fXvyLSpmQ0BnUWqLZSpx2XEQzBZySOoltjNQA51I+oqUAH73obCwQcMg2/mMNGJx xWUKuCzfte/PxacYrkdDkBmdStt8VsDRJci0YXV5vC6hbNoqzaXWSC/nK4EGbdUU OqXWFxR6gQ+VRSCLICnn2qNtxq7WC8mw090UXTwI0wpABcngUcdQePQ7bBAnOgDF BE9TpxRNCHVS/IGPYsyzms6rRZJ2glyj6en/LzRXoH4AuQZdjdYg5qQ1ojEBQAZQ xFkhvt93adBXI/GEFcws9W2+72oaCSPgmZSc9JC2rK3BL2lN/Wps9KUMl9Pt5sRQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefhedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeekteelheffgeefvddufeeujeekhfdvtdeuuedvveet ieevheeludegjeduhffhteenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgr rhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5D83CAC04C2; Tue, 7 Sep 2021 10:18:47 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1126-g6962059b07-fm-20210901.001-g6962059b Mime-Version: 1.0 Message-ID: <6d73cf96-5891-4a36-a7ea-10381a4ab6fe@www.fastmail.com> In-Reply-To: References: Date: Tue, 07 Sep 2021 09:18:27 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] Alias stdClass to DynamicObject? From: larry@garfieldtech.com ("Larry Garfield") On Tue, Sep 7, 2021, at 4:22 AM, Nikita Popov wrote: > On Mon, Sep 6, 2021 at 6:50 PM Kamil Tekiela wrote: > > > Hi Nikita, > > > > I think this might be a good idea, but I would like to propose yet another > > variant. > > Replace stdClass with DynamicObject and keep stdClass as an alias. It can > > be deprecated in 8.3. > > If we only add an alias, I am afraid that it will not catch on quickly > > enough. What I am proposing is that the cast to object will create > > DynamicObject by default. > > > > $arr = [1,2]; > > var_dump((object) $arr); > > Output: > > object(DynamicObject)#1 (2) { > > ["0"]=> > > int(1) > > ["1"]=> > > int(2) > > } > > > > It will break unit tests and it might break some code (e.g. `if ('stdClass' > > === $class)`), but it will help people understand what is the preferred > > name going forward without deprecating it right now. > > > > My only apprehension with making stdClass rather than DynamicObject the > alias is the widespread impact this will have on extension testing code. > https://github.com/php/php-src/pull/7475 shows the approximate impact on > php-src. We need to update references to stdClass in var_dump() output in > more than 300 tests. We can do this easily, but it will be an inconvenience > for 3rd party extension tests that need to deal with more than one PHP > version. > > Apart from that I agree that making DynamicObject the actual name and > stdClass the alias would be better. > > Regards, > Nikita Adding the alias, I'm fully on board with. Removing stdClass any time before PHP 10, I'm not on board with. The user space breakage potential is too large to even be thinking about that at this point. Flipping the alias around... again, I'm very concerned about the BC breakage. Apparently `readonly` caused problems for Wordpress, which is doubleplusungood. I would assume that we can't safely change which is the real name until proven otherwise, and based on Nikita's comments about PHP's own tests, I'd say it's definitely not proven otherwise. --Larry Garfield