Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128666 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 739EC1A00BC for ; Wed, 10 Sep 2025 14:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1757513307; bh=r79g03ZJpynYB3aKGpSu4LAx6Y9Vn/LVnPyobjLNx+U=; h=References:In-Reply-To:From:Date:Subject:To:From; b=n1KcM+nJDiPBInxe85sZPZ2UT/XiPdbSePZI4gxACEwsYO2iJMkT0xbUUaJg5ESqk FUda6AELPxbsnCTUmk9rkLkX+ItzaFSLtc0qxWjWSjm56bGxQi48xnQINMVO1EnQIv 3+qPZeyfkR+U/yr3NQh6rWo0oGoA9EIezHxSRW7+f/ipVFfRhVaxhPQcWhATQT0DUn OjSMN658aULCm9/GqPnmhenhrkp8nhmIL00HwJXSM4bUGfVRyb/6pE9BKIp+ahNOoe sGICBGweu/SUd7AlhHOHLT0922sk/UpA0E3h768FCWFPkLyIPQ9Kk30H6po+ixz3Gr 8mQSfnh1e68HQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 86B251801EB for ; Wed, 10 Sep 2025 14:08:26 +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_40,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (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 14:08:26 +0000 (UTC) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-30ccec928f6so2793250fac.3 for ; Wed, 10 Sep 2025 07:09:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757513392; x=1758118192; h=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=r79g03ZJpynYB3aKGpSu4LAx6Y9Vn/LVnPyobjLNx+U=; b=A6JCT+xp0fb1cZdKRx3sJuUxqzmA1+SnTkZ5LGnxa6IZyVMtQEY64ocEbdCNKN7zOL wPgQ6cQk2eDTp8g69vDvauG7wj9TxHJRIFmN2KebM2RXICKSPlNeKkxYFKdPN5JbCgTo a7tMj+0CJQx3KI1DFYYfP7sGpCWG28rGTtqR6vlHN9uzKxPaAu1Wi8h4t81mUssqyCmp o35sL2/frGJ63W3/lifbTeOHiLtZzVWq02Lee/AiXALiurVtUdCGMSsaHopl253Hbg4P lOei10Uwsn37utI+60U5IAhtrEYNnBRzaUbZsEFuIjX8QQ+jkuaJicx1Ez7W9JZKyU/8 E4tA== X-Gm-Message-State: AOJu0Yy5kfdUbcpzQhmVZPS6ZTNlUW0rQv6HjYdof11iZvuXNF4EjU5Z 4ynYGp+IhmM+OJQE4tNGCOGaZyE0sRxBm90BxkTWPyz+xNYZr2Z/cwXVMaJZUJNSeDS7/CSzOae n5PHuzpswAKUEYUH+Xz/ge0nITDntq5KQ/sSG X-Gm-Gg: ASbGncs+C3rtSstzKX0iGWTvq1RlPW4GaTb4Z67sFJu36H182LLVrTmjJmEvhHxQUZd Frbvm4aActwb8XH+CYrW0fbBT1DdLcjGLErQpjz7fvOgRL8FILu0PHDANbU/0x1Qag4EXVkdLnK RlvGluDCUiUsjsCq9ZgKerkY1uwB9G2R/eQciCzi9agwZAJZeJa2Q4IPS/s/gJSKKvmvdw1kGaZ rsClcw= X-Google-Smtp-Source: AGHT+IHLb2KWsh0KcnNC9KhIyi33aLE6Oufc/yBGr7Wli3YhXThcfURYM0ngqLkobjM2YEy7t01d3BmH7wIjjWzJwHQ= X-Received: by 2002:a05:6871:c305:b0:30b:b045:18df with SMTP id 586e51a60fabf-32264e24043mr8314715fac.35.1757513392188; Wed, 10 Sep 2025 07:09:52 -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 16:09:41 +0200 X-Gm-Features: Ac12FXzcxK2mGA9rt_WOgSnVQ5GTfaP_HlS6r_98g9gHSMPDjBT3C3UsF69i6gU Message-ID: Subject: Re: [PHP-DEV] [RFC] Soft-Deprecate __sleep() and __wakeup() To: PHP Internals List Content-Type: multipart/alternative; boundary="0000000000006df313063e72f98d" From: bukka@php.net (Jakub Zelenka) --0000000000006df313063e72f98d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Wed, Sep 10, 2025 at 3:23=E2=80=AFPM Jakub Zelenka wrote= : > 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 on the topic. >> >> TL;DR, this is about converting the deprecation of __sleep and __wakeup >> to 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 strin= g > 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 th= e > 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 understandin= g > of mangling. > I just had a chat with Nicolas and he asked me to add it and co-author the RFC so the section added here: https://wiki.php.net/rfc/soft-deprecate-sleep-wakeup#complex_handling_of_ma= ngled_property_names_with_persistent_storage Kind regards, Jakub --0000000000006df313063e72f98d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Wed, Sep 10, 2025 at 3:23= =E2=80=AFPM Jakub Zelenka <bukka@php.ne= t> wrote:
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/12= 8226#128456 I wrote this RFC to formalize our consensus=C2=A0on the top= ic.

TL;DR, this is about converting the deprecatio= n of __sleep and __wakeup to a documentation-based soft deprecation:
<= div>https://wiki.php.net/rfc/soft-deprecate-sleep-wakeup
<= div>

We just had a discussi= on 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 obje= ct is serialized, that string is stored into database. So when the applicat= ion is deployed, it should still work in the same way when unserializing th= e 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" pref= ix). 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=C2=A0get_mangled_object_vars and filter the mangled names. Altern= atively it could use=C2=A0__serialize with the new names but then it will n= eed to deal with new and old (mangled) formats in __unserialize. In any cas= e it means that the users will be required to deal with the mangled propert= y name and get some understanding of mangling.

I just had a chat with Nicolas and he asked me to add= it and co-author the RFC so the section added here:=C2=A0=C2=A0https://wiki.php.net/rfc/soft= -deprecate-sleep-wakeup#complex_handling_of_mangled_property_names_with_per= sistent_storage

Kind regards,

<= /div>
Jakub
--0000000000006df313063e72f98d--