From fa8fa31a8ffa35c47d610326178edc8f1d217632 Mon Sep 17 00:00:00 2001 From: Peter Zsoldos Date: Mon, 10 Dec 2012 11:15:56 +0100 Subject: [PATCH] Enhanced the "unrecognized opcode" error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since other exception messages also include the details of what data was wrong, I appended the unrecognizable opcode to the message after I had to debug a  non-deserializeable string in our system. --- phpserialize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpserialize.py b/phpserialize.py index 036cfb4..de62f78 100644 --- a/phpserialize.py +++ b/phpserialize.py @@ -507,7 +507,7 @@ def _unserialize(): if decode_strings: name = name.decode(charset, errors) return object_hook(name, dict(_load_array())) - raise ValueError('unexpected opcode') + raise ValueError('unexpected opcode - %s' % repr(type_)) return _unserialize()