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->query("CREATE TABLE test033 (t char($len))"); 26$db->query("INSERT INTO test033 (t) VALUES($quoted)"); 27 28$stmt = $db->prepare('SELECT * from test033'); 29$stmt->execute(); 30 31print_r($stmt->fetchAll(PDO::FETCH_ASSOC)); 32?> 33--CLEAN-- 34<?php 35require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 36$db = PDOTest::factory(); 37PDOTest::dropTableIfExists($db, "test033"); 38?> 39--EXPECT-- 40Array 41( 42 [0] => Array 43 ( 44 [t] => !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ 45 ) 46 47) 48