1--TEST-- 2MySQL PDO->quote(), properly handle binary data 3--EXTENSIONS-- 4pdo_mysql 5--SKIPIF-- 6<?php 7require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 8MySQLPDOTest::skip(); 9?> 10--FILE-- 11<?php 12 require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 13 $db = MySQLPDOTest::factory(); 14 $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); 15 16 // Force the connection to utf8, which is enough to make the test fail 17 // MySQL 5.6+ would be required for utf8mb4 18 $db->exec("SET NAMES 'utf8'"); 19 20 $content = "\xC3\xA1\xC3"; 21 $quoted = $db->quote($content, PDO::PARAM_LOB); 22 23 var_dump($quoted); 24 var_dump($db->query("SELECT HEX({$quoted})")->fetch(PDO::FETCH_NUM)[0]); 25?> 26--EXPECTF-- 27string(%d) "_binary'%s'" 28string(6) "C3A1C3" 29