diff options
author | Ulf Wendel <uw@php.net> | 2008-07-24 12:54:50 +0000 |
---|---|---|
committer | Ulf Wendel <uw@php.net> | 2008-07-24 12:54:50 +0000 |
commit | 60e70d1760e3588435587c7de9e720326a39f040 (patch) | |
tree | dd141657a99fc18d14d0a5656f39c38ba0f2c669 | |
parent | 44f1ef210d03519b716e4befec51fdba0427b264 (diff) | |
download | php-git-60e70d1760e3588435587c7de9e720326a39f040.tar.gz |
MFH (32bit fix)
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_types.phpt | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/pdo_mysql/tests/pdo_mysql_types.phpt b/ext/pdo_mysql/tests/pdo_mysql_types.phpt index ae4005b8c6..7bd58232c5 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_types.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_types.phpt @@ -10,7 +10,7 @@ MySQLPDOTest::skip(); <?php require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); - function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) { + function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL, $alternative_type = NULL) { $db->exec('DROP TABLE IF EXISTS test'); $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine()); @@ -57,10 +57,11 @@ MySQLPDOTest::skip(); // typically the difference is only the type $exp = $ret_value; } - if ($row['label'] !== $exp) { - printf("[%03d + 4] %s - input = %s/%s, output = %s/%s\n", $offset, + if ($row['label'] !== $exp && !is_null($alternative_type) && gettype($row['label']) != $alternative_type) { + printf("[%03d + 4] %s - input = %s/%s, output = %s/%s (alternative type: %s)\n", $offset, $sql_type, var_export($exp, true), gettype($exp), - var_export($row['label'], true), gettype($row['label'])); + var_export($row['label'], true), gettype($row['label']), + $alternative_type); return false; } @@ -102,8 +103,11 @@ MySQLPDOTest::skip(); test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608'); test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215'); - test_type($db, 100, 'INT', -2147483648, ($is_mysqlnd) ? -2147483648 : '-2147483648'); - test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? 4294967295 : '4294967295'); + test_type($db, 100, 'INT', -2147483648, + ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648', + NULL, ($is_mysqlnd) ? 'integer' : NULL); + + test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295'); // no chance to return int with the current PDO version - we are forced to return strings test_type($db, 120, 'BIGINT', 1, ($is_mysqlnd) ? 1 : '1'); |