note 40757 deleted from function.unserialize by aharvey
| From: | aharvey@php.net | Date: | Tue, 06 Nov 2012 01:18:12 +0000 |
| Subject: | note 40757 deleted from function.unserialize by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191687@lists.php.net to get a copy of this message | ||
Note Submitter:
----
If a a string is unserializeable FALSE is returned as well as an E_NOTICE error. This is odd since
you may want to know if a given string converts back to a PHP value and act accordingly. If you run
your script with E_ALL reporting this will show up.
I noticed this debugging this line of code:
$b = unserialize(base64_decode($a));
Curiously, base64_decode() does not throw errors if the string can't be decoded. The only
workaround is to prepend the @ operator to unserialize() or to change the error level.