Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125421 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 qa.php.net (Postfix) with ESMTPS id 267E41A00BD for ; Wed, 4 Sep 2024 19:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725479018; bh=nPUWTw410GCYKULUEpzbdbNvtR5CcGWkfLsUKK0ek6I=; h=Date:From:To:In-Reply-To:References:Subject:From; b=QCDeyKoYjl8m+EiOQzKr2cpaR4uQeDb38lioUgdNEHVIHdaXbN7IFlKtWU1Mey6ty R1kp5MZf5q1YMUqJ2/+8uv9jjhSK3cpItYb6ahcWe80MUwOZVbRF2Ab+su2QlEXPNb cEYnkn1v8p/o8doOWxJNQ+SQw7Hidz7LCryr3LpGVubVfTQ/LC8Ch6ie5o5vxVrPef H8TFYz3U8Jk5+wZSV29waF017TAbMV6Ig8AEzeU0DBySivA29aXqACp+EUCt1AQIjt Kq0aiC4b6a7b1uiZOJuTR49p7aJYihLFhk8Vl2Xt4l0YvvncvHJsyxIiqfuSoXFzbr PxNlGl4OXrByA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 18BFC180032 for ; Wed, 4 Sep 2024 19:43:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh4-smtp.messagingengine.com (fhigh4-smtp.messagingengine.com [103.168.172.155]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 4 Sep 2024 19:43:37 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3AB9F11401E1 for ; Wed, 4 Sep 2024 15:41:39 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-03.internal (MEProxy); Wed, 04 Sep 2024 15:41:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1725478899; x=1725565299; bh=nPUWTw410G CYKULUEpzbdbNvtR5CcGWkfLsUKK0ek6I=; b=AYSCk6QWlzKzhp/KSESZ3s/9ey 7guGqUwtJ+z0/0PUTJOWxX751KJqBkbshF7ocEGnV/PUaY3ax+H0DCsemg+ytObo Hi3XzNmIVaagPyGWzo8tueOP9iC/aU3WBDMKbbuOTgdLefTiSg+mbx9pVvHeIxRN 1njkrdYDbxmFT20Ubkx1JeessvidAAEITkhEQMWqPyPMPSMdk+iePowtBGRzqCyJ Q2ugF9YqDzjLAF71dA/Oqr5eD48yn/sSdWCWRF3chL2HJvv8WXi7VFqaPQemiGwo i3u7CRwJRnr1t513Wf+PWaySW+Rkd1MDnHRQwIrJzM3QLw53iRlLCU1FXahw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1725478899; x=1725565299; bh=nPUWTw410GCYKULUEpzbdbNvtR5C cGWkfLsUKK0ek6I=; b=P897fjTUzMSZ+u3lZB//0yhuevgy4ke8kzXrAbeEfttE +8fSKMbAXVmsElkmF/14vyEcgIZlsvgF1avUg4Bl4GxHaa2+Nn0k8t2+kZEgEOlQ DsEHUMSk3zdYD+TP/CghkUj4vWP92hotE2aHxSXOnJuZn1GdA3aqLvWegbJR1v3u PmHwzT13eYvG2fTNGvkK6dJ7v6q5ZA8ifUhD/w9F5VNumjcJvk9Vssfj1y1Imh6Z 3BPhn0rgrQcYGBv9C/Lxcxj96tzjqAhQdygfShhNxCzk57ldilTnbQOp6xSU6m0s n0C4amOq6uJlXnOGcTFlNYRZwrx7wqc3CCGVJXQF2w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudehjedgudeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepofggff fhvffkjghfufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdf uceorhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnhepheeiff ekteeljeeufeejffeuffehvedugfetveefieejveffhffhgeeuteetffelnecuffhomhgr ihhnpehphhhprdhnvghtpdhgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghs pdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinh htvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id E9598780067; Wed, 4 Sep 2024 15:41:38 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 04 Sep 2024 21:41:17 +0200 To: internals@lists.php.net Message-ID: In-Reply-To: References: Subject: Re: [PHP-DEV] RFC: Deprecate json_encode() on classes marked as non-serializable Content-Type: multipart/alternative; boundary=2fc240995b9942d29d60589b73e83bfb From: rob@bottled.codes ("Rob Landers") --2fc240995b9942d29d60589b73e83bfb Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Sep 3, 2024, at 13:24, Philip Hofstetter wrote: > Hello, >=20 > As per my previous email to the list, I have now created the official = RFC to deprecate calling json_serialize() on instances of classes marked= with ZEND_ACC_NOT_SERIALIZABLE. >=20 > https://wiki.php.net/rfc/deprecate-json_encode-nonserializable >=20 > I have also created a PR with the implementation here: >=20 > https://github.com/php/php-src/pull/15724 >=20 > I have considered other options, both constraining the implementation = to just Generator and/or to add special cases for Generator (and maybe I= terator), but they either continue to keep the asymmetry between seriali= ze() and json_encode() and/or are making things even more inconsistent. >=20 > Please tell me what you think, especially, if you agree that blanked-d= eprecating all of ZEND_ACC_NOT_SERIALIZABLE classes is acceptable BC-wis= e (after a bit of deliberation over the weekend, I think it is and most = json-serializations of such marked classes are probably unintentional). >=20 > Thanks in advance for all comments >=20 > Philip >=20 >=20 Hello Phillip. I think it would be good to list these non-serializable objects in the R= FC. It doesn't have to be exhaustive, but the list includes throwables, = weak-maps, weak-references, closures, fibers, etc. Some people may be re= lying on this behavior (and I'd be curious to know that use case myself). I just grepped for @not-serializable in php-src stubs, which appears to = be the only use of ZEND_ACC_NOT_SERIALIZABLE. =E2=80=94 Rob --2fc240995b9942d29d60589b73e83bfb Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Tue, Sep 3, = 2024, at 13:24, Philip Hofstetter wrote:
Hello,

As per my = previous email to the list, I have now created the official RFC to depre= cate calling json_serialize() on instances of classes marked with ZEND_A= CC_NOT_SERIALIZABLE.


I have also created= a PR with the implementation here:

=
<= br>
I have considered other options, both constrai= ning the implementation to just Generator and/or to add special cases fo= r Generator (and maybe Iterator), but they either continue to keep the a= symmetry between serialize() and json_encode() and/or are making things = even more inconsistent.

Please tell me what you think, especially, if you agree that blanke= d-deprecating all of ZEND_ACC_NOT_SERIALIZABLE classes is acceptable BC-= wise (after a bit of deliberation over the weekend, I think it is and mo= st json-serializations of such marked classes are probably unintentional= ).

Thanks in advanc= e for all comments

= Philip



Hello Phillip.

I think it would be good to list these non-serializ= able objects in the RFC. It doesn't have to be exhaustive, but the list = includes throwables, weak-maps, weak-references, closures, fibers, etc. = Some people may be relying on this behavior (and I'd be curious to know = that use case myself).

I just grepped for&n= bsp;@not-serializable in php-src stubs, which appears to be the only use= of ZEND_ACC_NOT_SERIALIZABLE.

=E2=80=94 Rob
--2fc240995b9942d29d60589b73e83bfb--