Bug #65376 [Com]: Unserialize function issue
| From: | anon at anon dot anon | Date: | Sat, 03 Aug 2013 12:28:46 +0000 |
| Subject: | Bug #65376 [Com]: Unserialize function issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-180696@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65376&edit=1
ID: 65376
Comment by: anon at anon dot anon
Reported by: carlosV2 dot 0 at gmail dot com
Summary: Unserialize function issue
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Mac OS X
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
@mike Did you just dismiss a feature request as "Not a bug"? Of course it's not a
bug, it's a feature request.
Previous Comments:
------------------------------------------------------------------------
[2013-08-02 11:20:20] 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-02 08:27:35] 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
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65376&edit=1