xref: /php-src/ext/pdo_mysql/tests/bug80808.phpt (revision 4bb75d56)
1--TEST--
2Bug #80808: PDO returns ZEROFILL integers without leading zeros
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12require_once __DIR__ . '/inc/mysql_pdo_test.inc';
13$pdo = MySQLPDOTest::factory();
14
15$pdo->exec('CREATE TABLE test_80808 (postcode INT(4) UNSIGNED ZEROFILL)');
16$pdo->exec('INSERT INTO test_80808 (postcode) VALUES (\'0800\')');
17
18$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
19var_dump($pdo->query('SELECT * FROM test_80808')->fetchColumn(0));
20$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
21var_dump($pdo->query('SELECT * FROM test_80808')->fetchColumn(0));
22?>
23--CLEAN--
24<?php
25require_once __DIR__ . '/inc/mysql_pdo_test.inc';
26$db = MySQLPDOTest::factory();
27$db->exec('DROP TABLE IF EXISTS test_80808');
28?>
29--EXPECT--
30string(4) "0800"
31string(4) "0800"
32