php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75289 Unserialize ArrayIterator incompatible between php 5.6 and 7.1
Submitted: 2017-09-29 19:34 UTC Modified: 2017-09-29 21:45 UTC
From: sp at feig-partner dot de Assigned:
Status: Not a bug Package: SPL related
PHP Version: 7.1.10 OS: irrelevant
Private report: No CVE-ID: None
 [2017-09-29 19:34 UTC] sp at feig-partner dot de
Description:
------------
This is a followup to this bug:
https://bugs.php.net/bug.php?id=74669

While serialization and unserialization in the same run now works:
https://3v4l.org/6c4RU

it still fails, when you're serializing in one run and unserializing in another.

Take the serialized output from here:
https://3v4l.org/bNCbY#v560

and unserialize it separately:
https://3v4l.org/EcAWQ

Gives "Notice: unserialize(): Error at offset 45 of 193 bytes in /in/EcAWQ on line 47"


With the serialized output from php5 the result is the same:
https://3v4l.org/v5D2l


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-29 19:50 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2017-09-29 19:50 UTC] nikic@php.net
serialize() output is binary data, and your method of copying the strings stripped the null bytes. Trying the same after an application of bin2hex and hex2bin worked for me.
 [2017-09-29 21:45 UTC] sp at feig-partner dot de
-Summary: Unserialize ArrayIterator broken +Summary: Unserialize ArrayIterator incompatible between php 5.6 and 7.1
 [2017-09-29 21:45 UTC] sp at feig-partner dot de
You're right, sorry. My debugging was flawed.

I have fixed my data and rerun my tests. There is still one little Problem. Serializing with php 5.6 and unserializing with php 7.1.10 still produces
"Fatal error: Uncaught UnexpectedValueException: Error at offset 13 of 26 bytes"

https://3v4l.org/ehJiR

I don't know if fixing that is worth the trouble, though.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC