Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129024 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 9624F1A00BC for ; Fri, 31 Oct 2025 12:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1761913029; bh=wjVNUTeJ4tIyGkPgU5qF9WqwptVuE+N3nrbXPY7GxqA=; h=References:In-Reply-To:Reply-To:From:Date:Subject:To:Cc:From; b=BzpIUYzZWjnVky3xLC5onijMK7Zkay/GKdN44RqJ860fr7OOCzEURHbyA5K9n+3nR DKW7y1pycrW0nh5M5DoKimq3Y6C1aALxfPBQZaGhuLGlZFd5GEZC0x9Z+Z6ieLtFsV 1azy1s3DvfioDx1Ul0cNtnVpD3X9L7bmTAP922RQGc5ZV/9xe9ppAiHIIrjsahl7t1 /EH+CTwZKoWbqSXtSeGJGbdsrPGSXT9gg+6yVixX7TxnXOHzt37ZcUM9uSwxibyE7C U3iXDvWZxzvkLi0w3K+YHKvGNzIccJCZsrHthTFMKOrlPFt/vIdVORY7xH5IVlPMY6 7MpC2N9DL8OnQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 24CBC180032 for ; Fri, 31 Oct 2025 12:17:05 +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=1.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLYTO,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (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 ; Fri, 31 Oct 2025 12:17:01 +0000 (UTC) Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-93e9b5bafa5so83444839f.3 for ; Fri, 31 Oct 2025 05:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761913016; x=1762517816; darn=lists.php.net; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wjVNUTeJ4tIyGkPgU5qF9WqwptVuE+N3nrbXPY7GxqA=; b=VcedVfVQDXfoqA4mHmT/wvvS2WMW6fY4LiwBsjoBjpgt0fwUdHtBo1wm7THKMTL1zu KyGxe3Wh+IGp3DY+nnYneMoEW4GMTwRs052Qv2rbeyyndXGkJKq2yYXCFF25eo/0ibtf bl/UHD7YDTtgtRI5yRAi2alvxvUe0JxGVm5Xd9n7TmAmcNZJ8mIw0aI7dszQBovrbMK8 bAUJLMaKYWiN+6SeJfzNSQXxvaD2CxPKZa4dDKa7lpMMzlJuoalmF+YOZ8+UZ0OeYLMb tNYMucIZ++L57Wo8ty5MoS0TDLO4l/beynNwI5Q+/cRs4ujswCU8+YMuxRoA4C1QnAMd Fs9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761913016; x=1762517816; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wjVNUTeJ4tIyGkPgU5qF9WqwptVuE+N3nrbXPY7GxqA=; b=HTMORS6SbRuSwEh4f6n+89XWU8545POXyq77xaAkk87BdqDABpjO5aKfrq0XVQAzV9 MBr+wp4mj+eQDhBbr2w9OfyW40Z18R9zgAQvTHXxaWnqlwbnmzIe6XFgp0QMZMTZrK87 vSCvrAfyLDlHFSPJ4zPBpzBqk5uHKH6YpPw8s2+dnb5ZX/LBH3852ZVNz/NpzK48w1Fn n8LOYzh029kL5szvgfk1cOpBjLw/yP0HwyOidrumIGyDShiS+18gM/gRzrZf73SBKBxj hFL0V56SyIOkwHMVI2nNb3Teo8fTiTEEQr5cjHa+L0ctIn+ZBR4RBTYrZ+2D1BAqj4Cw GUrg== X-Forwarded-Encrypted: i=1; AJvYcCX2e5CxEZlt7VYMf37GnJXjSLYNrYBvN56ZTlPYd3AzXd3xBqK8fXAijn784oI8ulZAZ7lqCn0zjm0=@lists.php.net X-Gm-Message-State: AOJu0YwKSMDiZtaWPoviWBtUGaE/i6gCSxL3WdhyaE7R6ylc2XfJeaGD pVjGme9P3lBeB88KN9/JPwfTYmhxSfjxYggSGrCIrzJmoDX4P9VxPC5H29catNX1iYM/kl7LQ8e Wymk2355NP6ITQkIjUXaDuWZyHrxIvvY= X-Gm-Gg: ASbGncuXq8bRd5SPmGtXUtc3nVpwK40gTkqJqjU2dCvDAmIafAmXZYHMi/bOwaYI+FO M0q+TB+6xHKdTjU8c+KlHGZekDPh9cOijUkgGFXwiHYNI7iA7bdaHXrAzlibrn/HyCNd3eZ79k+ SdAA+b/q7PZfCDHIyGwSVh7LKJDNWgTHNDN5WM25R/AMy39B4OcQZ8s/tL9pZDO4p90aYPrbhJk c7uBzM8eZk9OXnt5n/rmk8KcKLqqLYxx7lrFAZYIiDOc+Fhud6hOc79J8QfOoZJ2AiHZR0m+23U gcdeVdpXu7RhH5OnYc8kzJ0FuUKc X-Google-Smtp-Source: AGHT+IGMPCxAvRjUCvYaeQaxlyqy/1qLAJfSmZ+JNWoKLcNs2LZHmyDbOsVyxWAm1S7U/T0R3DIIcHcVyliQQWMHuE8= X-Received: by 2002:a05:6e02:1606:b0:430:aedb:3719 with SMTP id e9e14a558f8ab-4330d125bc1mr50414615ab.4.1761913015983; Fri, 31 Oct 2025 05:16:55 -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> <3a20b5ef66fc23de6bad022685b41190@bastelstu.be> In-Reply-To: <3a20b5ef66fc23de6bad022685b41190@bastelstu.be> Reply-To: erictnorris@gmail.com Date: Fri, 31 Oct 2025 08:16:47 -0400 X-Gm-Features: AWmQ_bkm2__JbRBaH-aRXLOdiiPf4ciq5ZB_QdTvtDu_nxtZDQ-6n3oWfz-yvDc 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: Dmytro Kulyk , Ilija Tovilo , PHP internals Content-Type: multipart/alternative; boundary="00000000000071644106427357f7" From: eric.t.norris@gmail.com (Eric Norris) --00000000000071644106427357f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Oct 31, 2025, 4:47=E2=80=AFAM Tim D=C3=BCsterhus = wrote: > Hi > > Am 2025-10-30 23:24, schrieb Dmytro Kulyk: > > 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 pro= perties > > 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 introdu= cing another > > attribute. > > That makes sense to me and I don't have a suggestion for a better name. > I hope I'm not starting a bikeshed discussion, but I've been following along - can I suggest "DoNotSerialize"? "NoSerialize" sounds odd to me, whereas "DoNotSerialize" can be seen as both an instruction to PHP - "don't serialize this property when serializing the class" - and an instruction to developers - "do not attempt to serialize this class". > --00000000000071644106427357f7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Oct 31, 2025, 4:47=E2=80=AFAM Ti= m D=C3=BCsterhus <tim@bastelstu.be> wrote:
Hi

Am 2025-10-30 23:24, schrieb Dmytro Kulyk:
> If we go in that direction, I=E2=80=99d suggest keeping the name
> #[NoSerialize], because it=E2=80=99s more general and clearly describe= s 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 pr= operties
> silently and preventing class serialization (by throwing).
>
> This way, the attribute name remains short and declarative, while the<= br> > 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 introd= ucing another
> attribute.

That makes sense to me and I don't have a suggestion for a better name.=

--00000000000071644106427357f7--