summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_mysql')
-rw-r--r--ext/pdo_mysql/tests/bug80808.phpt27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/pdo_mysql/tests/bug80808.phpt b/ext/pdo_mysql/tests/bug80808.phpt
new file mode 100644
index 0000000000..364b559a4c
--- /dev/null
+++ b/ext/pdo_mysql/tests/bug80808.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #80808: PDO returns ZEROFILL integers without leading zeros
+--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');
+$pdo = MySQLPDOTest::factory();
+
+$pdo->exec('DROP TABLE IF EXISTS test');
+$pdo->exec('CREATE TABLE test (postcode INT(4) UNSIGNED ZEROFILL)');
+$pdo->exec('INSERT INTO test (postcode) VALUES (\'0800\')');
+
+$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
+var_dump($pdo->query('SELECT * FROM test')->fetchColumn(0));
+$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+var_dump($pdo->query('SELECT * FROM test')->fetchColumn(0));
+
+?>
+--EXPECT--
+string(4) "0800"
+string(4) "0800"