From 432b3274df645143dd207dd7f899268305e18c25 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 3 Aug 2010 07:23:55 +0000
Subject: [PATCH] UnserializableException: Handle exceptions whose code is not
 an int.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2465 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Error/UnserializableException.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/SimpleSAML/Error/UnserializableException.php b/lib/SimpleSAML/Error/UnserializableException.php
index 9798a29a1..9a5995c04 100644
--- a/lib/SimpleSAML/Error/UnserializableException.php
+++ b/lib/SimpleSAML/Error/UnserializableException.php
@@ -19,6 +19,12 @@ class SimpleSAML_Error_UnserializableException extends SimpleSAML_Error_Exceptio
 
 		$msg = get_class($original) . ': ' . $original->getMessage();
 		$code = $original->getCode();
+
+		if (!is_int($code)) {
+			/* PDOException uses a string as the code. Filter it out here. */
+			$code = -1;
+		}
+
 		parent::__construct($msg, $code);
 
 		$this->setBacktrace(SimpleSAML_Utilities::buildBacktrace($original));
-- 
GitLab