mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
3a867b9827
If the ZEROFILL flag is set for a field, do not convert it into an integer (text protocol) or convert it explicitly into a padded string (binary protocol).
28 lines
812 B
PHP
28 lines
812 B
PHP
--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"
|