php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65376 Unserialize function issue
Submitted: 2013-08-02 08:27 UTC Modified: 2013-08-03 12:43 UTC
From: carlosV2 dot 0 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: Mac OS X
Private report: No CVE-ID: None
 [2013-08-02 08:27 UTC] carlosV2 dot 0 at gmail dot com
Description:
------------
I think the unserialize method should have a final string length check.

You can make objects disappear just running the code in the Test Script:

This code outputs just the first object.
This is something it can easily happend when you are working with sockets or data 
streams.

Probably it is the developer's fault but actually to serialized objects together 
are not only one object.

I think checking the string length at the end of the parser and rising a warning 
is enough to alert the developer that this things are happening.

Test script:
---------------
$o1 = new stdClass();
$o1->name = 'Object1';

$o2 = new stdClass();
$o2->name = 'Object2';

$objects = serialize($o1) . serialize($o2);
print_r(unserialize($objects));

Expected result:
----------------
A warning

Actual result:
--------------
Only the first object:

stdClass Object
(
    [name] => Object1
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-02 11:20 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-08-02 11:20 UTC] mike@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

.
 [2013-08-03 12:28 UTC] anon at anon dot anon
@mike Did you just dismiss a feature request as "Not a bug"? Of course it's not a bug, it's a feature request.
 [2013-08-03 12:43 UTC] johannes@php.net
This is a feature we(at least on internal C level) use in different places on purpose. This feature won't be changed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 04:01:33 2024 UTC