From:             carlosV2 dot 0 at gmail dot com
Operating system: Mac OS X
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Bug
Bug description:Unserialize function issue

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 bug report at https://bugs.php.net/bug.php?id=65376&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65376&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65376&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65376&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65376&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65376&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65376&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65376&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65376&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65376&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65376&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65376&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65376&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65376&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65376&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65376&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65376&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65376&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65376&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65376&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65376&r=mysqlcfg

Reply via email to