Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129014 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 A85C41A00BC for ; Thu, 30 Oct 2025 22:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761863068; bh=PZsHT5PAC6ta96IOKUEAuBxx737+s68Lo+/bWlkb138=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=VfuLm5RsXlCl1lE5/d9sNHm/SJkFSu6Fzqm3rWWD5SBzf3rmR4GkH1jUm4yEd380z SBR2vHvKQTnTcJsfso1lDxzLisB14h3hwmsM6umjw9D3sY+RIW/Vh6dTxzeuEr5ZJy Wv4MKmTfuNCd2DmpH7iaSRpwUhZkAlkdgwjzIYBoBKV8WR1dSZDF3fgunpgaZ5aF3O mRSNVGpx7f1YzN/nnakNOBtElhfjjB/eGPs+P6T3VYTp8Bzwz8+FO/1hqAw+eP5y73 TR7gUTCbMvJIb/ujzxJZ1xyc+8gBV0xWxUSCeN0Amq/DfrGBM9dnI13j9NNE22udwe 9NVgzCv1K9+4A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 629301801E5 for ; Thu, 30 Oct 2025 22:24:27 +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, 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-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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, 30 Oct 2025 22:24:27 +0000 (UTC) Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-b6cf07258e8so1065590a12.1 for ; Thu, 30 Oct 2025 15:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761863061; x=1762467861; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PZsHT5PAC6ta96IOKUEAuBxx737+s68Lo+/bWlkb138=; b=hsZNKAYC7DjqB8jV2R0t83HPeZ6gDPXlXCR5yaORCkYLu2hRVRaLEt9hCidQsTVfpb UKFYzQCsUgEdqjdrvLBR5OYr8EqMfWeWpRWg6t108bC3xw+H4egKVleoma9BJO+EvJ/d QW+tu4PBMHueeTuqegS3td20Lm/db3nIcBnsV4G+pOI4ECXTM0st6uA1RJ4mgPQJBJIP RlT2de8XajY0aoYy1suBQIwTmPeTQJGp1OyWJZ4+ytdSsm/hRv3VW+9Krmj3y8NFcJRV 6dfcS0Yo4mq6IHrbW5HEwl+0QY0Va/lJiLYc+HxlbAwRCsLYnelLm7jSBwUk5HeF7a2T HSEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761863061; x=1762467861; h=content-transfer-encoding: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=PZsHT5PAC6ta96IOKUEAuBxx737+s68Lo+/bWlkb138=; b=s5El8mNKJuNxF4vRkv7UgrSkXQ80GVvH4B/8F3AStbJ1g+gamzbFN4QZ2QtNap7Fu+ BWahQTUvu7CUc2BNq/4IMLITGhpPi/rpH3oXXoKyC75APVBx9lcv25zdl174utv2Hjjm pEM/aUZfDtLr0ikQUo7YT1tzRg4ZCp7R7m1yIu4V0T+N9x8EeDhI6Wm4QZfPtXDwbWwM OAgldxW+aMRiJfOoiS958VIStighBS9BD836D2b5YXAr5eHegB2RDiNu4X6FchlzNuEK P7cM/Y+s6+iAH01SrPjMJxMt2JkuwhEnIhVqaWfAcHW3aEST+gzHWR8wYF/pKz+tW/eA nGug== X-Forwarded-Encrypted: i=1; AJvYcCW+12DP9sH4gwv9A5LuZIkxU+XEyJ3ej9Um0tWn5bRbhTSZrpA25bcgpQ1JqXv7I3l5zXJdnLx5598=@lists.php.net X-Gm-Message-State: AOJu0YxicTjg7XwCk8AUjqXEm8EPVXf7BuH5tDELOZ3f0HELezDgYzbU +glh4pYWuZ4VfUFWVP3UsfBeWs8XRIP/ZG9NHJwuEgum7/EhCWcAXbZveS9croNp9Xf3wIFNxY3 YjvAAeJeCJlrTowEoCFtL/lGRS+XnDqk= X-Gm-Gg: ASbGncvnUfe9lEN6rr0Fo3pxWuRjJ/W9/WubI+QCMNTT8yKIcQRGiS3ge9gvHq3E1oP HKAocq+aSjsIcwuhSRSTi/+eoruURtFmVHeULlx/sv1cm+1fVO5Pahi0cJOQcwZmVL4bEmlb4dz n42phudBxuOYOMHj0sJ8sgWSbmFamte1dnBIcl8ZLc95mX2s68mcphxZDdNyZuPv6Ndo+boDNNI 1xhdTLrYZdC2KLrkIemiDb16A4ktflF90HYK3E3y6ppTgzuoQFewwifIY+G X-Google-Smtp-Source: AGHT+IFl9xKgoa7MB7X8g5K13JCdiwt/hNDNb8WfcseFOs4xufxgCrMorbRLYOrg6Sjo4+tEG4UcoO9wjEVtW++kJV8= X-Received: by 2002:a17:902:f68f:b0:27e:e55f:c6c3 with SMTP id d9443c01a7336-2951a4bf87dmr19187165ad.55.1761863061166; Thu, 30 Oct 2025 15:24:21 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <4b6abc36d8ab6cd306e95141869db3b0@bastelstu.be> <21ff8dee5016a1b7ecc412c44233abd1@bastelstu.be> In-Reply-To: <21ff8dee5016a1b7ecc412c44233abd1@bastelstu.be> Date: Fri, 31 Oct 2025 00:24:09 +0200 X-Gm-Features: AWmQ_bnlSb17VDm_MEq7ZLUg66IvGmriwf0IbxFABuP289XtvLBlLVrznL4ykks Message-ID: Subject: Re: [PHP-DEV] [RFC][Discussion] Add #[NoSerialize] attribute for excluding properties or classes from serialization To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Ilija Tovilo , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: lnkvisitor.ts@gmail.com (Dmytro Kulyk) > I am just noticing that your RFC still is marked as Draft, both within > the RFC text and within the overview at https://wiki.php.net/rfc. Don't > forget to adjust the status to =E2=80=9CUnder Discussion=E2=80=9D for pro= per visibility. > > Am 2025-10-29 23:23, schrieb Dmytro Kulyk: > > It already makes no sense because the class-level attribute will be > > excluded from the RFC, and I have no plan to add something like this > > to #[NotSerializable]. It may be added in a future RFC. > > I am seeing that you adjusted the RFC to remove the support for applying > `#[\NoSerialize]` to classes. Given that we determined that serializing > classes should either throw or work (i.e. that serializing them to > `null` is never right), I don't think that two separate attributes are > necessary. While a combined attribute would behave somewhat differently > for classes and properties, the name of `#[\NoSerialize]` and > `#[\NotSerializable]` is very similar and thus confusing in itself. I > would suggest to merge the RFCs of `#[\NoSerialize]` and > `#[\NotSerializable]` into a single attribute, since in both cases you > are indicating =E2=80=9CI don't want this serialized=E2=80=9D and I think= it is > reasonable to expect from users to learn that there is some difference > in behavior for properties compared to classes. > Thanks, that=E2=80=99s a fair point =E2=80=94 combining both proposals woul= d definitely simplify the user-facing story and avoid naming confusion. If we go in that direction, I=E2=80=99d suggest keeping the name #[NoSerialize], because it=E2=80=99s more general and clearly describes the action rather than the failure mode. #[NotSerializable] reads more like an error state, while #[NoSerialize] works naturally for both contexts =E2=80=94 skipping propert= ies silently and preventing class serialization (by throwing). This way, the attribute name remains short and declarative, while the actual behavior (throwing vs skipping) can be determined by where it=E2=80= =99s applied =E2=80=94 on a class or on a property =E2=80=94 without introducing= another attribute. Best, Dmytro