note 130124 added to function.igbinary-unserialize

From: Date: Sun, 09 Mar 2025 18:15:21 +0000
Subject: note 130124 added to function.igbinary-unserialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-221954@lists.php.net to get a copy of this message
This little function returns true if a data string was made by igbinary_serialize() and can be passed to igbinary_unseriaize(). function is_igbinary($data) { return is_string($data) && '00000002' === bin2hex(substr($data, 0, 4)); } It doesn't validate the contents of the data string, or ensure it is safe to decode if it came from an untrusted source. But it is handy when trying to avoid unserializing data that wasn't serialized. ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 2603:7081:7000:82cc:ec8c:52f2:63cf:3e8c) ---- Manual Page -- https://php.net/manual/en/function.igbinary-unserialize.php Edit -- https://main.php.net/note/edit/130124 Del: integrated -- https://main.php.net/note/delete/130124/integrated Del: useless -- https://main.php.net/note/delete/130124/useless Del: bad code -- https://main.php.net/note/delete/130124/bad+code Del: spam -- https://main.php.net/note/delete/130124/spam Del: non-english -- https://main.php.net/note/delete/130124/non-english Del: in docs -- https://main.php.net/note/delete/130124/in+docs Del: other reasons-- https://main.php.net/note/delete/130124 Reject -- https://main.php.net/note/reject/130124 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221954) next »