note 129854 added to function.unserialize
| From: | Anonymous | Date: | Wed, 13 Nov 2024 19:59:34 +0000 |
| Subject: | note 129854 added to function.unserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221651@lists.php.net to get a copy of this message | ||
Please note there is a minor difference in how unserializa() works between PHP 7 and 8.
Under PHP 8, strings that are not trimmed of whitespace will emit a warning in the likes of:
PHP Warning: unserialize(): Extra data starting at offset 721 of 722 bytes in /tmp/a.php on line 4
so something like:
$s = 's:3:"bar";'."\n"
unserialize($s); # warning emitted
unserialize(trim($s)); # no warning
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 8.37.110.42)
----
Manual Page -- https://php.net/manual/en/function.unserialize.php
Edit -- https://main.php.net/note/edit/129854
Del: integrated -- https://main.php.net/note/delete/129854/integrated
Del: useless -- https://main.php.net/note/delete/129854/useless
Del: bad code -- https://main.php.net/note/delete/129854/bad+code
Del: spam -- https://main.php.net/note/delete/129854/spam
Del: non-english -- https://main.php.net/note/delete/129854/non-english
Del: in docs -- https://main.php.net/note/delete/129854/in+docs
Del: other reasons-- https://main.php.net/note/delete/129854
Reject -- https://main.php.net/note/reject/129854
Search -- https://main.php.net/manage/user-notes.php