php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79526 `__sleep` error message doesn't include the name of the class
Submitted: 2020-04-27 00:20 UTC Modified: 2020-04-27 01:12 UTC
From: carusogabriel@php.net Assigned:
Status: Closed Package: Class/Object related
PHP Version: 7.3.17 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: carusogabriel@php.net
New email:
PHP Version: OS:

 

 [2020-04-27 00:20 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-27 01:12 UTC] requinix@php.net
-Summary: `__sleep` error message wrong +Summary: `__sleep` error message doesn't include the name of the class -Package: *Compile Issues +Package: Class/Object related
 [2020-04-27 01:12 UTC] requinix@php.net
The error message is correct, it just doesn't also include the name of the faulty class.
 [2020-04-28 06:18 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d906eb23f6cc86c69f7edc2732d7a46901b992a3
Log: Fixed bug #79526 (`__sleep` error message doesn't include the name of the class)
 [2020-04-28 06:18 UTC] laruence@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC