1--TEST-- 2PDO Common: PECL Bug #5217 (serialize/unserialize safety) 3--SKIPIF-- 4<?php 5if (!extension_loaded('pdo')) die('skip'); 6$dir = getenv('REDIR_TEST_DIR'); 7if (false == $dir) die('skip no driver'); 8require_once $dir . 'pdo_test.inc'; 9PDOTest::skip(); 10?> 11--FILE-- 12<?php 13if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); 14require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 15$db = PDOTest::factory(); 16try { 17 $ser = serialize($db); 18 debug_zval_dump($ser); 19 $db = unserialize($ser); 20 $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))'); 21} catch (Exception $e) { 22 echo "Safely caught " . $e->getMessage() . "\n"; 23} 24 25echo "PHP Didn't crash!\n"; 26?> 27--EXPECT-- 28Safely caught Serialization of 'PDO' is not allowed 29PHP Didn't crash! 30