bug80808.phpt 777 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #80808: PDO returns ZEROFILL integers without leading zeros
  3. --EXTENSIONS--
  4. pdo_mysql
  5. --SKIPIF--
  6. <?php
  7. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  8. MySQLPDOTest::skip();
  9. ?>
  10. --FILE--
  11. <?php
  12. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  13. $pdo = MySQLPDOTest::factory();
  14. $pdo->exec('DROP TABLE IF EXISTS test');
  15. $pdo->exec('CREATE TABLE test (postcode INT(4) UNSIGNED ZEROFILL)');
  16. $pdo->exec('INSERT INTO test (postcode) VALUES (\'0800\')');
  17. $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
  18. var_dump($pdo->query('SELECT * FROM test')->fetchColumn(0));
  19. $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
  20. var_dump($pdo->query('SELECT * FROM test')->fetchColumn(0));
  21. ?>
  22. --EXPECT--
  23. string(4) "0800"
  24. string(4) "0800"