1--TEST-- 2PDO Common: PDO::quote() 3--EXTENSIONS-- 4pdo 5--SKIPIF-- 6<?php 7$dir = getenv('REDIR_TEST_DIR'); 8if (false == $dir) die('skip no driver'); 9if (!strncasecmp(getenv('PDOTEST_DSN'), 'odbc', strlen('odbc'))) die('skip odbc driver doesn\'t have escape API, use prepared statements'); 10require_once $dir . 'pdo_test.inc'; 11PDOTest::skip(); 12?> 13--FILE-- 14<?php 15if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); 16require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 17$db = PDOTest::factory(); 18 19$unquoted = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; 20 21$quoted = $db->quote($unquoted); 22 23$len = strlen($unquoted); 24 25@$db->exec("DROP TABLE test"); 26 27$db->query("CREATE TABLE test (t char($len))"); 28$db->query("INSERT INTO test (t) VALUES($quoted)"); 29 30$stmt = $db->prepare('SELECT * from test'); 31$stmt->execute(); 32 33print_r($stmt->fetchAll(PDO::FETCH_ASSOC)); 34 35$db->exec("DROP TABLE test"); 36 37?> 38--EXPECT-- 39Array 40( 41 [0] => Array 42 ( 43 [t] => !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 44 ) 45 46) 47