Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.112
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
php-7.4.33 /
ext /
pdo_mysql /
tests /
Delete
Unzip
Name
Size
Permission
Date
Action
CONFLICTS
6
B
-rw-rw-r--
2022-10-31 11:36
PDO_getAvaliableDrivers.phpt
344
B
-rw-rw-r--
2022-10-31 11:36
README.md
725
B
-rw-rw-r--
2022-10-31 11:36
bug41125.phpt
4.46
KB
-rw-rw-r--
2022-10-31 11:36
bug44327.phpt
1.53
KB
-rw-rw-r--
2022-10-31 11:36
bug46292.phpt
1.82
KB
-rw-rw-r--
2022-10-31 11:36
bug53551.phpt
1.61
KB
-rw-rw-r--
2022-10-31 11:36
bug53782.phpt
874
B
-rw-rw-r--
2022-10-31 11:36
bug54929.phpt
1.65
KB
-rw-rw-r--
2022-10-31 11:36
bug63176.phpt
1.12
KB
-rw-rw-r--
2022-10-31 11:36
bug63185.phpt
1.62
KB
-rw-rw-r--
2022-10-31 11:36
bug66141.phpt
1.24
KB
-rw-rw-r--
2022-10-31 11:36
bug66528.phpt
2.09
KB
-rw-rw-r--
2022-10-31 11:36
bug68371.phpt
2.21
KB
-rw-rw-r--
2022-10-31 11:36
bug70066.phpt
798
B
-rw-rw-r--
2022-10-31 11:36
bug70272.phpt
644
B
-rw-rw-r--
2022-10-31 11:36
bug70389.phpt
670
B
-rw-rw-r--
2022-10-31 11:36
bug70862.phpt
1.16
KB
-rw-rw-r--
2022-10-31 11:36
bug71145.phpt
688
B
-rw-rw-r--
2022-10-31 11:36
bug71569.phpt
546
B
-rw-rw-r--
2022-10-31 11:36
bug75177.phpt
832
B
-rw-rw-r--
2022-10-31 11:36
bug76815.phpt
969
B
-rw-rw-r--
2022-10-31 11:36
bug77289.phpt
657
B
-rw-rw-r--
2022-10-31 11:36
bug78152.phpt
1.12
KB
-rw-rw-r--
2022-10-31 11:36
bug79375.phpt
3.3
KB
-rw-rw-r--
2022-10-31 11:36
bug79596.phpt
894
B
-rw-rw-r--
2022-10-31 11:36
bug80458.phpt
4.23
KB
-rw-rw-r--
2022-10-31 11:36
bug81037.phpt
1.02
KB
-rw-rw-r--
2022-10-31 11:36
bug_33689.phpt
1.47
KB
-rw-rw-r--
2022-10-31 11:36
bug_37445.phpt
694
B
-rw-rw-r--
2022-10-31 11:36
bug_38546.phpt
6.12
KB
-rw-rw-r--
2022-10-31 11:36
bug_39483.phpt
714
B
-rw-rw-r--
2022-10-31 11:36
bug_39858.phpt
2.29
KB
-rw-rw-r--
2022-10-31 11:36
bug_41125.phpt
1.69
KB
-rw-rw-r--
2022-10-31 11:36
bug_41698.phpt
988
B
-rw-rw-r--
2022-10-31 11:36
bug_41997.phpt
1.56
KB
-rw-rw-r--
2022-10-31 11:36
bug_42499.phpt
2.79
KB
-rw-rw-r--
2022-10-31 11:36
bug_43371.phpt
476
B
-rw-rw-r--
2022-10-31 11:36
bug_44454.phpt
2.88
KB
-rw-rw-r--
2022-10-31 11:36
bug_44707.phpt
2.46
KB
-rw-rw-r--
2022-10-31 11:36
bug_45120.phpt
1.3
KB
-rw-rw-r--
2022-10-31 11:36
bug_50323.phpt
1.64
KB
-rw-rw-r--
2022-10-31 11:36
bug_51670.phpt
689
B
-rw-rw-r--
2022-10-31 11:36
bug_61207.phpt
2.38
KB
-rw-rw-r--
2022-10-31 11:36
bug_61411.phpt
1.32
KB
-rw-rw-r--
2022-10-31 11:36
bug_61755.phpt
1
KB
-rw-rw-r--
2022-10-31 11:36
bug_64705.phpt
427
B
-rw-rw-r--
2022-10-31 11:36
bug_74376.phpt
859
B
-rw-rw-r--
2022-10-31 11:36
bug_pecl_12925.phpt
1.38
KB
-rw-rw-r--
2022-10-31 11:36
bug_pecl_7976.phpt
2.05
KB
-rw-rw-r--
2022-10-31 11:36
common.phpt
794
B
-rw-rw-r--
2022-10-31 11:36
config.inc
2.23
KB
-rw-rw-r--
2022-10-31 11:36
last_insert_id.phpt
934
B
-rw-rw-r--
2022-10-31 11:36
mysql_pdo_test.inc
4.44
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql___construct.phpt
11.09
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql___construct_ini.phpt
1.38
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql___construct_options.phpt
7.71
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql___construct_options_libmysql.phpt
3.09
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql___construct_uri.phpt
2.13
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_autocommit.phpt
3.47
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_case.phpt
5.1
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_client_version.phpt
1.13
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_connection_status.phpt
939
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_driver_name.phpt
830
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_errmode.phpt
5.41
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_fetch_table_names.phpt
900
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_init_command.phpt
1.17
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_max_buffer_size.phpt
2.14
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_multi_statements.phpt
2.21
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_oracle_nulls.phpt
3.22
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_prefetch.phpt
651
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_server_info.phpt
1.63
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_server_version.phpt
2.46
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_attr_statement_class.phpt
5.26
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_begintransaction.phpt
7.29
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_bit.phpt
1.76
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_class_constants.phpt
2.98
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_commit.phpt
3.2
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_connect_attr.phpt
1.9
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_connect_charset.phpt
1.08
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_errorcode.phpt
2.22
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_errorinfo.phpt
3.25
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_exec.phpt
7.25
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_exec_ddl.phpt
2.78
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_exec_load_data.phpt
3.6
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_exec_select.phpt
2.57
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_fetch_both.phpt
1.74
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_get_attribute.phpt
2.82
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_interface.phpt
1.45
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_last_insert_id.phpt
4.2
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_local_infile_default_off.phpt
668
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_local_infile_set_on.phpt
693
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_multi_stmt_nextrowset.phpt
4.98
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_param_str_natl.phpt
1.04
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_pconnect.phpt
3.23
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_phpinfo.phpt
738
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_emulated.phpt
13.92
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_emulated_anonymous.phpt
2.5
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
2.67
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_match_against.phpt
1.42
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native.phpt
12.8
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native_clear_error.phpt
3.31
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native_column.phpt
1.28
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native_dup_named_placeholder.phpt
4.11
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native_mixed_style.phpt
1.39
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native_named_placeholder.phpt
2.8
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_prepare_native_placeholder_everywhere.phpt
2.59
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_quote.phpt
1.07
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_rollback.phpt
2.78
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_bindcolumn.phpt
4.05
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_bindparam.phpt
5.19
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_bindparam_types.phpt
7.46
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_bindvalue.phpt
11.76
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_blobfromsteam.phpt
3.94
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_blobs.phpt
2.63
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_closecursor.phpt
6.9
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_closecursor_empty.phpt
2.18
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_columncount.phpt
1.91
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_errorcode.phpt
1.88
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_errorinfo.phpt
3.19
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_fetch_non_select.phpt
6.05
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_fetch_serialize.phpt
4.19
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_fetch_serialize_simple.phpt
2.96
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_fetchobject.phpt
2.68
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_getcolumnmeta.phpt
12.94
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_multiquery.phpt
2.47
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_nextrowset.phpt
5.75
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_rowcount.phpt
933
B
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_unbuffered_2050.phpt
4.77
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_stmt_variable_columncount.phpt
4.01
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_subclass.phpt
2.32
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_types.phpt
6.83
KB
-rw-rw-r--
2022-10-31 11:36
pdo_mysql_types_zerofill.phpt
4.37
KB
-rw-rw-r--
2022-10-31 11:36
pecl_bug_5200.phpt
968
B
-rw-rw-r--
2022-10-31 11:36
pecl_bug_5780.phpt
1.5
KB
-rw-rw-r--
2022-10-31 11:36
pecl_bug_5802.phpt
1.33
KB
-rw-rw-r--
2022-10-31 11:36
show_tables.phpt
480
B
-rw-rw-r--
2022-10-31 11:36
skipif.inc
112
B
-rw-rw-r--
2022-10-31 11:36
table.inc
399
B
-rw-rw-r--
2022-10-31 11:36
Save
Rename
--TEST-- MySQL PDO->__construct() - Generic + DSN --SKIPIF-- <?php require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc'); require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); MySQLPDOTest::skip(); ?> --FILE-- <?php require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); function tryandcatch($offset, $code) { try { eval($code); assert(sprintf("[%03d] Should have failed\n", $offset) != ''); } catch (PDOException $e) { return sprintf("[%03d] %s, [%s] %s\n", $offset, $e->getMessage(), (isset($db) && is_object($db)) ? $db->errorCode() : 'n/a', (isset($db) && is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); } return ''; } try { try { if (NULL !== ($db = @new PDO())) printf("[001] Too few parameters\n"); } catch (TypeError $ex) { } print tryandcatch(2, '$db = new PDO(chr(0));'); print tryandcatch(3, '$db = new PDO("a" . chr(0) . "b");'); print tryandcatch(4, '$db = new PDO("MYSQL");'); print tryandcatch(5, '$db = new PDO("mysql");'); print tryandcatch(6, '$db = new PDO("mysql ");'); print tryandcatch(7, '$db = new PDO("fantasyandfriends :");'); $dsn = PDO_MYSQL_TEST_DSN; // MySQL Server might accept anonymous connections, don't // print anything tryandcatch(8, '$db = new PDO("' . $dsn . '");'); $user = 'dontcreatesuchauser'; $pass = 'withthispassword'; print tryandcatch(9, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); // should fail $dsn = 'mysql:'; // don't print the message since it can be different tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); $dsn = PDO_MYSQL_TEST_DSN; $user = PDO_MYSQL_TEST_USER; $pass = PDO_MYSQL_TEST_PASS; // should work... $db = new PDO($dsn, $user, $pass); // Reaction on host not specified differs for different configs, so no printing $dsn = 'mysql:invalid=foo'; tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); $dsn = 'mysql:' . str_repeat('howmuch=canpdoeat;', 1000); tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); $dsn = 'mysql:' . str_repeat('abcdefghij', 1024 * 10) . '=somevalue'; tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");'); if (PDO_MYSQL_TEST_HOST) { $host = PDO_MYSQL_TEST_HOST; $invalid_host = $host . 'invalid'; // last host specification should be the one used $dsn = MySQLPDOTest::getDSN(array('host' => $host), 'host=' . $invalid_host); try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { $tmp = $e->getMessage(); if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) printf("[014] Cannot find proper error codes: %s\n", $tmp); } $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host); try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { printf("[015] DSN=%s, %s\n", $dsn, $e->getMessage()); } $invalid_host = '-' . chr(0); $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host)); try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { $tmp = $e->getMessage(); if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) printf("[016] Cannot find proper error codes: %s\n", $tmp); } // parsing should not get confused by chr(0) $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host); try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { printf("[017] DSN=%s, %s\n", $dsn, $e->getMessage()); } } // what about long values for a valid option ... // hostnames > 1024 chars break on some NIS-enabled FreeBSD... $dsn = MySQLPDOTest::getDSN(array('host' => str_repeat('0123456789', 100))); try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { $tmp = $e->getMessage(); if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002')) printf("[018] Cannot find proper error codes: %s\n", $tmp); } if (PDO_MYSQL_TEST_PORT && (PDO_MYSQL_TEST_SOCKET == '')) { // Playing with the port makes only sense if no socket gets used $port = PDO_MYSQL_TEST_PORT; // let's hope we don't hit a MySQL running on that port... $invalid_port = $port * 2; $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port); try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { $tmp = $e->getMessage(); if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005')) printf("[019] Cannot find proper error codes: %s\n", $tmp); } $dsn = MySQLPDOTest::getDSN(array('port' => $invalid_port), 'port=' . $port); try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { printf("[020] DSN=%s, %s\n", $dsn, $e->getMessage()); } $invalid_port = 'abc'; $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port); try { $db = @new PDO($dsn, $user, $pass); // atoi('abc') = 0, 0 -> fallback to default 3306 -> may or may not fail! } catch (PDOException $e) { } } if (PDO_MYSQL_TEST_DB) { $db = PDO_MYSQL_TEST_DB; $invalid_db = 'letshopeitdoesnotexist'; $dsn = MySQLPDOTest::getDSN(array('dbname' => $db), 'dbname=' . $invalid_db); try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { $tmp = $e->getMessage(); if (!stristr($tmp, '42000') && !stristr($tmp, '1049')) printf("[022] Cannot find proper error codes: %s\n", $tmp); } $dsn = MySQLPDOTest::getDSN(array('dbname' => $invalid_db), 'dbname=' . $db); try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { printf("[023] DSN=%s, %s\n", $dsn, $e->getMessage()); } } if (PDO_MYSQL_TEST_SOCKET && (stristr(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_SOCKET) !== false)) { $socket = PDO_MYSQL_TEST_SOCKET; $invalid_socket = '/lets/hope/it/does/not/exist'; $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $socket), 'unix_socket=' . $invalid_socket); try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) { $tmp = $e->getMessage(); if (!stristr($tmp, 'HY000') && !stristr($tmp, '2002')) printf("[024] Cannot find proper error codes: %s\n", $tmp); } $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $invalid_socket), 'unix_socket=' . $socket); try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) { printf("[025] DSN=%s, %s\n", $dsn, $e->getMessage()); } } $have_charset_support = false; $dsn = MySQLPDOTest::getDSN(); try { $db = new PDO($dsn, $user, $pass); $stmt = $db->query('SELECT VERSION() as _version'); $version = $stmt->fetch(PDO::FETCH_ASSOC); $tmp = explode('.', $version['_version']); if ((count($tmp) == 3) && (($tmp[0] >= 4 && $tmp[1] >= 1) || ($tmp[0] >= 5))) { // MySQL Server 4.1 - charset support available $have_charset_support = true; } } catch (PDOException $e) { printf("[026] DSN=%s, %s\n", $dsn, $e->getMessage()); } if (PDO_MYSQL_TEST_CHARSET) { $charset = PDO_MYSQL_TEST_CHARSET; $invalid_charset = 'invalid'; if ($have_charset_support) { $dsn = MySQLPDOTest::getDSN(); $db = new PDO($dsn, $user, $pass); $stmt = $db->query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset)); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); $have_charset = (empty($tmp)) ? false : true; if ($have_charset) { $dsn = MySQLPDOTest::getDSN(array('charset' => $charset), 'charset=' . $invalid_charset); try { $db = @new PDO($dsn, $user, $pass); /* NOTE: MySQL does a fallback to the charset suggested during the handshake - no error - no bug! */ } catch (PDOException $e) { $tmp = $e->getMessage(); /* TODO: add proper codes */ if (!stristr($tmp, 'sqlstatecode') || !stristr($tmp, 'mysqlinternalerrcode')) printf("[027] TODO - Cannot find proper error codes: %s\n", $tmp); } $dsn = MySQLPDOTest::getDSN(array('charset' => $invalid_charset), 'charset=' . $charset); try { $db = @new PDO($dsn, $user, $pass); /* Strictly speaking we should test more: character_set_client, character_set_results, and character_set_connection */ $stmt = $db->query('SELECT @@character_set_connection AS _charset'); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); if ($tmp['_charset'] != $charset) printf("[028] Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", $tmp['_charset'], $charset); } catch (PDOException $e) { printf("[029] DSN=%s, %s\n", $dsn, $e->getMessage()); } } else { printf("[030] You're trying to run the tests with charset '%s' which seems not supported by the server!", $charset); } } } if ($have_charset_support) { // In case the PDO_MYSQL_TEST_CHARSET interferes with any defaults // we do another test to verify that the charset has been set. $dsn = MySQLPDOTest::getDSN(); $db = new PDO($dsn, $user, $pass); $stmt = $db->query('SHOW CHARACTER SET LIKE "latin1"'); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); $have_latin1 =(empty($tmp)) ? false : true; $stmt = $db->query('SHOW CHARACTER SET LIKE "latin2"'); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); $have_latin2 =(empty($tmp)) ? false : true; if ($have_latin1 && $have_latin2) { // very likely we do have both of them... try { $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin1')); $db = new PDO($dsn, $user, $pass); $stmt = $db->query('SELECT @@character_set_connection AS _charset'); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); if ($tmp['_charset'] != 'latin1') printf("[031] DSN = %s, Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", $dsn, $tmp['_charset'], 'latin1'); } catch (PDOException $e) { printf("[032] %s\n", $e->getMessage()); } try { $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin2')); $db = new PDO($dsn, $user, $pass); $stmt = $db->query('SELECT @@character_set_connection AS _charset'); $tmp = $stmt->fetch(PDO::FETCH_ASSOC); if ($tmp['_charset'] != 'latin2') printf("[033] DSN = %s, character sets has not been set, @@character_set_connection reports '%s', expecting '%s'", $dsn, $tmp['_charset'], 'latin2'); } catch (PDOException $e) { printf("[034] %s\n", $e->getMessage()); } } } } catch (PDOException $e) { printf("[001] %s, [%s] %s\n", $e->getMessage(), (is_object($db)) ? $db->errorCode() : 'n/a', (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a'); } print "done!"; ?> --EXPECTF-- [002] invalid data source name, [n/a] n/a [003] invalid data source name, [n/a] n/a [004] invalid data source name, [n/a] n/a [005] invalid data source name, [n/a] n/a [006] invalid data source name, [n/a] n/a [007] could not find driver, [n/a] n/a [009] SQLSTATE[%s] [1045] Access denied for user 'dont%s'@'%s' (using password: YES), [n/a] n/a [017] DSN=%s, SQLSTATE[%s] [%d] %s done!