Bug #79526 [Opn]: `__sleep` error message doesn't include the name of the class

From: Date: Mon, 27 Apr 2020 01:12:05 +0000
Subject: Bug #79526 [Opn]: `__sleep` error message doesn't include the name of the class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226788@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79526&edit=1 ID: 79526 Updated by: requinix@php.net Reported by: carusogabriel@php.net -Summary: __sleep error message wrong +Summary: __sleep error message doesn't include the name of the class Status: Open Type: Bug -Package: *Compile Issues +Package: Class/Object related Operating System: * PHP Version: 7.3.17 Block user comment: N Private report: N New Comment: The error message is correct, it just doesn't also include the name of the faulty class. Previous Comments: ------------------------------------------------------------------------ [2020-04-27 00:20:02] carusogabriel@php.net Description: ------------ Although we have a new Serialization mechanism (https://wiki.php.net/rfc/custom_object_serialization), this bug still persists on PHP 7,3 as: When returning something different from an array when calling serialize() on a class that has the method __sleep implemented, the error message says that a serialize(): __sleep should return an array, instead of Foo::__sleep(). Test script: --------------- <?php class Foo { public function __sleep() { return 1; } } serialize(new Foo()); Expected result: ---------------- Notice: Foo::__sleep() should return an array only containing the names of instance-variables to serialize in %d on line %d Actual result: -------------- Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize in %d on line %d ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79526&edit=1

« previous php.bugs (#226788) next »