Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121978 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73405 invoked from network); 9 Dec 2023 23:46:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Dec 2023 23:46:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 11DFF180051 for ; Sat, 9 Dec 2023 15:46:30 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (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 ; Sat, 9 Dec 2023 15:46:29 -0800 (PST) Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-58e28e0461bso1868937eaf.1 for ; Sat, 09 Dec 2023 15:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702165574; x=1702770374; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vvqPD0KDZzN3fCbzUpr7miCq5/s43JuzRgwhnCuKmAI=; b=jBqer2wdKWB+bUsEfpUhmluRAsuEjsss2eM9v70YVsneI5BWTYkj4wIq8lwSda5+lx muzYkz10mB/YqK33shKUkMxhhB2daiYkXWFHupOH1qV6oNn1H+zsHtAQpiV2zIpv17j7 mZbHW93oC8M/emUbiO9HOAjyaOOXqja854U/gOMIlm+KLWsxREf9NIHw/9teSapjy8SM 08vqROL/KV/V3ApGXNmwh1314giOUj3opvU2UWaPXLcIti/pL260uh9i5I+he0UNXQig R5IAwX1JsPnSjTn+0k4zaaB6gXgh6uNC9DwfdDRgN/nu2EWj8RaNaGvClimWvoTuR8kb Gd4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702165574; x=1702770374; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vvqPD0KDZzN3fCbzUpr7miCq5/s43JuzRgwhnCuKmAI=; b=u/iauxFlqik+KZRfRRVhAIwHYcq+duIyoEl38U11rIUlLN0R1vvl1605HFHqN4jBie SzqzTAckui3z3ALgTqiDpOl6yxaBl710UUJn7KGWwDxVNrnuutPpKM0Xrx6/QQL+NAjF WcMbFyQImu8wHIFjyek0ZJPX7tEni9xOXwBal96ii38GvgBfOZFIblu7k11SJFHY8u+w cSwdElO948a4w0Pi1BSGCXu1Kp6HPYAlBgS6+FAAt3XfcoY+yweZN/F6JZa1VNb1BWhj 6YcsUBw0PtemYSbk4nfIDMybtSvCDZ2SHNQEqHCp9WF+J0kQEVkKGf67nUt69LvU+XtK 1hTg== X-Gm-Message-State: AOJu0YxJNdEb1gTMDCvGMGcg5PlfjVxfyJUUHoPWggZB+MUNiFK7o98d 3g+3Vp7Hh+lble90mNSMW51/LWx8J+dTD/0X3XE/B+2AauM= X-Google-Smtp-Source: AGHT+IGxgLVlVc0oW9ZE3Ni9Hs61g1Wvko21eHFyL6UnQ/LzFAzHRLDMEmtP103jaczWXzLtnsVV8r+eipKuQHFGYJI= X-Received: by 2002:a05:6359:63a3:b0:170:3ee9:ab4e with SMTP id sg35-20020a05635963a300b001703ee9ab4emr1595224rwb.46.1702165573932; Sat, 09 Dec 2023 15:46:13 -0800 (PST) MIME-Version: 1.0 References: <54BE3A8E-046E-495E-B371-CCF917B6BB49@gmail.com> In-Reply-To: <54BE3A8E-046E-495E-B371-CCF917B6BB49@gmail.com> Date: Sat, 9 Dec 2023 23:46:02 +0000 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000062186e060c1c4e3c" Subject: Re: [PHP-DEV] [RFC][Discussion] NotSerializable attribute From: george.banyard@gmail.com ("G. P. B.") --00000000000062186e060c1c4e3c Content-Type: text/plain; charset="UTF-8" The implementation is simple and straight to the point, and uses machinery that has been added to the engine to deal more consistently with internal classes. In an ideal world (IMHO) serialization would be opt-in and __serialize() would be used to enable and describe the serialization format. However, this is not the case, and IMHO implementing __serialize() should only be done to change the *default* serialization format *not* to disable it. Exposing this to userland makes sense, as this would prevented the mess that was the Serializable interface that people used to disable serialization which was less then ideal. Moreover, having this as an attribute means, that even without adding a new method to ReflectionClass, you could determine via Reflection if this class is serializable or not. Because currently, the only way to know if it is *actually* serializable is to call serialize() on the object and see what happens. On Sat, 9 Dec 2023 at 17:16, Rowan Tommins wrote: > On 9 December 2023 12:30:29 GMT, Max Semenik > wrote: > >Hi, I'd like to propose a new attribute, #[NotSerializable]. This > >functionality is already available for internal classes - userspace should > >benefit from it, too. > > If this ends up approximately the same as implementing serialisation as an > exception, it feels quite a thin feature. If you put __sleep and __wakeup > as shown into a trait, it's already as short and explicit as "use > NotSerializable;" > If the alternative solution is a trait, then it is, IMHO, a bad alternative solution. What would make it more compelling is if the engine itself could do more > with the attribute. For instance, a direct isSerializable() on > ReflectionClass that covered both internal and attribute-marked classes. > I do agree, adding a isSerializable() function to ReflectionClass is a good idea. Best regards, Gina P. Banyard --00000000000062186e060c1c4e3c--