php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70390 Invalid object size in serialized string
Submitted: 2015-08-29 16:29 UTC Modified: 2015-08-29 17:18 UTC
From: alec at alec dot pl Assigned: cmb (profile)
Status: Duplicate Package: Unknown/Other Function
PHP Version: 7.0.0RC1 OS: Linux
Private report: No CVE-ID: None
 [2015-08-29 16:29 UTC] alec at alec dot pl
Description:
------------
Number of properties of serialized object is wrong after setting unknown property and unsetting an existing one. This causes that the object can't be unserialized. See test script.

Test script:
---------------
<?php

class test
{
    public $prop;
}

$test = new test;
$test->unknown = 'test';
unset($test->prop);

print_r(unserialize(serialize($test)));

Expected result:
----------------
test Object
(
    [unknown] => test
)


Actual result:
--------------
PHP Notice:  unserialize(): Unexpected end of serialized data in test.php on line 17
PHP Notice:  unserialize(): Error at offset 39 of 40 bytes in test.php on line 17


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-29 17:18 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2015-08-29 17:18 UTC] cmb@php.net
This is a duplicate of bug #70187, which has already been fixed in
latest master.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Aug 25 18:01:28 2019 UTC