Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128665 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 730BB1A00BC for ; Wed, 10 Sep 2025 13:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1757510522; bh=N1ho0gG76Dw/MqsKfCIwwysKCoHFcoR3yT1njUxwOng=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=fe0MfdJ1X3r6NCckvcNeMDA17KkLMJTFh6G1RpqpPWvQD3j6o1JLfcMe100+JGDQi tAGs0mvXKAu25ZdN+HXzJ2Rao7ke3sLBcdyBMz7DQZInxgT+H38zAy7ztBz+Zcj4eY DNmSiebccKSnIPY1qybuEeAvNs4RQtP3cGPKpQ9entOfTSydSgHMNAGzzaX2yEhAF6 C/aclTOSJDzBOZm0Kya+2PnJrvTenCZeR1pV8LDNIAEh/s9+gijCCnkNkrmsWggS7f wiJWHYY0aGGETbIRQ0q+PObYzi0UITqdx5k/Z4CE5ERgxpyuiC5ryG7ORJScRvVh8d K+baBAq6CKDmw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 703A41801DA for ; Wed, 10 Sep 2025 13:22:01 +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.0 required=5.0 tests=BAYES_20,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, 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.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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 ; Wed, 10 Sep 2025 13:22:01 +0000 (UTC) Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-745a415bf72so2503759a34.2 for ; Wed, 10 Sep 2025 06:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757510607; x=1758115407; 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=N1ho0gG76Dw/MqsKfCIwwysKCoHFcoR3yT1njUxwOng=; b=CbGtUaVfB14YbE+hwtwPMjTQNSmxaIrUZAGN84smP5qCd9AiL1m170q2UuaUqS+uDm gIBfySzGf4LwttCEPLZ/bMhfXDLa2Ruv/1XCnvOPId56BJrRU5pqJ4ZJBQc+uwou2hUD 72kRegFTB4jaDmlEvcFdixY6IRB2mbuNSDFce0AnpE5hUL2ElPGsS2yjFY7cj68kCye5 FtGdmgfXdW6qClDP2DQ/VM+3mO+awP9O0HmQdXxOFwPzotJ7Y17dLOfiWoS+Oh7fN9bH xawpFQnvb01NbPdXDVM89PLcp57eD9NIZ4XqfhGSFBjDUELICo1ctw24WYLGkIgoS2xa qu3w== X-Gm-Message-State: AOJu0YypVG+Grshf6G/3QjkCcR1EgbehtvDFYzB8JCPdoAVje7vaixeA RLegty60D3+cFj2IRadjGgsIW+ZBRBPz5S7W/ILR+o+iiG2vFP+xRWA4QbqlgChY9bSnd6UuEIa 9/r9TVSeEC/CNgOHDE1tykJjopdbYqi4sUlgJ X-Gm-Gg: ASbGnct6crsoRVET/Iov2LKCHUk1tjdfUWnzfAEuPdAGlsEJ/y3cp+RKuLTSzO1FbXj N8X/qsCZVPDjqCFmNQimpdjSmSOa2UmVYgwFJNxS5h1ywBRL/q767uZv4czTrRsK6LSEWcgTQhX ERNK/zNj2p+2KgVIS4VmQfXfe3RjmdDlPulL+Rokki1dER5a/zuu4oxOnwydCNnYLsQvxgkWsB+ uabYSmjqetc27I92A== X-Google-Smtp-Source: AGHT+IHQ+CQs6tN2db+IJcQ9Fnc7p8JCTdPNutK79cgvIgZ1XM1ePZmBQKtx0zjRgwr3UCaUmOk20W/OzemVEVXp25k= X-Received: by 2002:a05:6808:444a:b0:438:3364:4c21 with SMTP id 5614622812f47-43b29af2b21mr6047486b6e.3.1757510606874; Wed, 10 Sep 2025 06:23:26 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 10 Sep 2025 15:23:15 +0200 X-Gm-Features: Ac12FXxKIfnkjoV3k3GzzZ-2G4vh8H6Tx0ikqeTKa5LT8JxlzMqPubDkFGf3Gq0 Message-ID: Subject: Re: [PHP-DEV] [RFC] Soft-Deprecate __sleep() and __wakeup() To: Nicolas Grekas Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000696bf5063e7253ba" From: bukka@php.net (Jakub Zelenka) --000000000000696bf5063e7253ba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Fri, Sep 5, 2025 at 5:55=E2=80=AFPM Nicolas Grekas wrote: > Hello internals, > > Following the discussion that started at > https://externals.io/message/128226#128456 I wrote this RFC to formalize > our consensus on the topic. > > TL;DR, this is about converting the deprecation of __sleep and __wakeup t= o > a documentation-based soft deprecation: > https://wiki.php.net/rfc/soft-deprecate-sleep-wakeup > > We just had a discussion privately about this and I came with one example that would be worth to add here. It is about storing the serialized string where application needs to care about working correctly with the old format. For example when object is serialized, that string is stored into database. So when the application is deployed, it should still work in the same way when unserializing the string. If __sleep is used to serialize private properties (not all but just some), then those property names are stored in the mangled format ("\x00" . self::class . "\x00" prefix). It means to make it compatible in __serialize, the application has to mangle property names - this can be done either manually prefixing the name or using get_mangled_object_vars and filter the mangled names. Alternatively it could use __serialize with the new names but then it will need to deal with new and old (mangled) formats in __unserialize. In any case it means that the users will be required to deal with the mangled property name and get some understanding of mangling. Kind regards, Jakub --000000000000696bf5063e7253ba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Fri, Sep = 5, 2025 at 5:55=E2=80=AFPM Nicolas Grekas <nicolas.grekas+php@gmail.com> wrote:
Hello internals,

Following the discussion that started at https://externals.io/message= /128226#128456 I wrote this RFC to formalize our consensus=C2=A0on the = topic.

TL;DR, this is about converting the depreca= tion of __sleep and __wakeup to a documentation-based soft deprecation:

We just had a discu= ssion privately about this and I came with one example that would be worth = to add here. It is about storing the serialized string where application ne= eds to care about working correctly with the old format. For example when o= bject is serialized, that string is stored into database. So when the appli= cation is deployed, it should still work in the same way when unserializing= the string.

If __sleep is used to serialize priva= te properties (not all but just some), then those property names are stored= in the mangled format ("\x00" . self::class . "\x00" p= refix). It means to make it compatible in __serialize, the application has = to mangle property names - this can be done either manually prefixing the n= ame or using=C2=A0get_mangled_object_vars and filter the mangled names. Alt= ernatively it could use=C2=A0__serialize with the new names but then it wil= l need to deal with new and old (mangled) formats in __unserialize. In any = case it means that the users will be required to deal with the mangled prop= erty name and get some understanding of mangling.

= Kind regards,

Jakub
--000000000000696bf5063e7253ba--