locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in serialize

gsusanj opened this issue · comments

This issue came out when I unserialized / serialized strings twice in a row.

First userialization / serialization seems succesfull but the second time an error is thrown in serialization.

Original string:
a:2:{i:2;a:4:{s:5:"title";s:0:"";s:5:"count";i:0;s:12:"hierarchical";i:0;s:8:"dropdown";i:0;}s:12:"_multiwidget";i:1;}
After first unserialization / serialization:
a:2:{i:2;a:4:{s:5:"title";s:0:"";s:5:"count";i:0;s:12:"hierarchical";i:0;s:8:"dropdown";i:0;};s:12:"_multiwidget";i:1;};

There seems to be extra semicolon after end of array declaration, and this is the problem.
For some reason the Serialization function assumes its a string not an array and automatically adds semicolon in the end of it twice.

Seems I missed the update and is already fixed, closing.