phpserialize icon indicating copy to clipboard operation
phpserialize copied to clipboard

Serialization of `'` character inconsistent with php

Open Valodim opened this issue 8 months ago • 1 comments

Hey there. Thanks for maintaining this library :) I recently encountered an error with serialization of the ' character in strings:

A string value like this: "can't stop the rock" will be serialized inconsistently with php, causing an error when unserialized:

Emitter Output
this library, v1.4.0 s:20:"can\'t stop the rock";
php 8.3.18 s:19:"can't stop the rock"; (reference)

Unserializing the serialized format with the extra apostrophe will work with this lib itself, but fails in php: Notice: unserialize(): Error at offset 26 of 27 bytes in /home/user/scripts/code.php on line 2

Valodim avatar May 05 '25 19:05 Valodim