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