Skip to content

Emit warning/reject data if there is more data to unserialize than expected #64

@TysonAndre

Description

@TysonAndre

See https://github.com/igbinary/igbinary/blob/9cca1574d9ee0ac58378965982309ae05e5a26e8/tests/igbinary_040.phpt

Currently, igbinary will unserialize the data without problems if there are extra bytes. However, extra bytes likely indicate that the data is corrupt/malformed.

php > var_export(bin2hex(igbinary_serialize(true)));
'0000000205'
php > var_export(igbinary_unserialize("\x00\x00\x00\x02\x05"));                                                                                      
true
php > var_export(igbinary_unserialize("\x00\x00\x00\x02\x05\xf8"));
true

Expected result for the last command: false and emit notice (Or a valid value and emit notice, possibly depending on an ini setting)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions