Bug #79447 [NEW]: Serializing uninitialized typed properties with __sleep should not throw

From: Date: Fri, 03 Apr 2020 15:06:57 +0000
Subject: Bug #79447 [NEW]: Serializing uninitialized typed properties with __sleep should not throw
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226427@lists.php.net to get a copy of this message
From: nicolasgrekas Operating system: PHP version: 7.4.4 Package: Scripting Engine problem Bug Type: Bug Bug description:Serializing uninitialized typed properties with __sleep should not throw Description: ------------ This is a follow up of https://bugs.php.net/bug.php?id=79002 The Symfony+Doctrine community is learning to use uninitialized properties, and we're having a bad time with __sleep(). The behavior implemented in https://github.com/php/php-src/commit/846b6479537a112d1ded725e6484e46462048b35 forbids serializing arbitrary objects (e.g.for hashing purpose). This forces us to catch and ignore "Throwable", which in turn might hide legit errors that ppl do need to see during development. Here is an example issue https://github.com/doctrine/common/issues/886 where this is discussed, originating from https://github.com/doctrine/orm/issues/8030, which in turns generates PRs like https://github.com/symfony/symfony/pull/36336 All this activity would disappear and things would work seamlessly if the engine would just ignore uninitialized properties returned by __sleep(). On unserialize(), such properties should be unserialized back to the "uninitialized" state. This would respect the semantics of serialize/unserialize and would solve all this complexity we don't know how to deal with. -- Edit bug report at https://bugs.php.net/bug.php?id=79447&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79447&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79447&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79447&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79447&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79447&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79447&r=support Expected behavior: https://bugs.php.net/fix.php?id=79447&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79447&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79447&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79447&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79447&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79447&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79447&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79447&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79447&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79447&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79447&r=mysqlcfg

« previous php.bugs (#226427) next »