diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2016-10-17 16:58:49 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2016-10-17 23:34:41 +0200 |
| commit | 86e603a664afdc3a12ead0eaca5d37fa8a379381 (patch) | |
| tree | feea44fc88e7ba7aa6b5273d9bd81f0632709e2a /ext/sqlite3/tests | |
| parent | e1f5b6d8dfe1543205d5b45d3dcf1d34f5e2e420 (diff) | |
| download | php-git-86e603a664afdc3a12ead0eaca5d37fa8a379381.tar.gz | |
Fix #73333: 2147483647 is fetched as string
We return all integers that can be represented as such by PHP as
integers, and only those that exceed the possible range as strings.
On builds which represent integers with 64 bits, the range check is
unnecessary and might cause code checkers to complain, so we skip this
special casing via the preprocessor according to
<http://git.php.net/?p=php-src.git;a=commit;h=99d087e5>.
Diffstat (limited to 'ext/sqlite3/tests')
| -rw-r--r-- | ext/sqlite3/tests/bug63921-32bit.phpt | 2 | ||||
| -rw-r--r-- | ext/sqlite3/tests/bug63921-64bit.phpt | 2 | ||||
| -rw-r--r-- | ext/sqlite3/tests/bug73333.phpt | 26 |
3 files changed, 28 insertions, 2 deletions
diff --git a/ext/sqlite3/tests/bug63921-32bit.phpt b/ext/sqlite3/tests/bug63921-32bit.phpt index 8c1c6b9414..d2cc7b2002 100644 --- a/ext/sqlite3/tests/bug63921-32bit.phpt +++ b/ext/sqlite3/tests/bug63921-32bit.phpt @@ -24,4 +24,4 @@ var_dump($num,$result[0]); ?> --EXPECT-- int(2147483647) -string(10) "2147483647" +int(2147483647) diff --git a/ext/sqlite3/tests/bug63921-64bit.phpt b/ext/sqlite3/tests/bug63921-64bit.phpt index 8e821fd2d0..d6c539e185 100644 --- a/ext/sqlite3/tests/bug63921-64bit.phpt +++ b/ext/sqlite3/tests/bug63921-64bit.phpt @@ -24,4 +24,4 @@ var_dump($num,$result[0]); ?> --EXPECT-- int(100004313234244) -string(15) "100004313234244" +int(100004313234244) diff --git a/ext/sqlite3/tests/bug73333.phpt b/ext/sqlite3/tests/bug73333.phpt new file mode 100644 index 0000000000..7315751810 --- /dev/null +++ b/ext/sqlite3/tests/bug73333.phpt @@ -0,0 +1,26 @@ +--TEST--
+Bug #73333 (2147483647 is fetched as string)
+--SKIPIF--
+<?php
+if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
+?>
+--FILE--
+<?php
+if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
+
+$db = new SQLite3(':memory:');
+$db->exec('CREATE TABLE foo (bar INT)');
+foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
+ $db->exec("INSERT INTO foo VALUES ($value)");
+}
+
+$res = $db->query('SELECT bar FROM foo');
+while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
+ echo gettype($row[0]), PHP_EOL;
+}
+?>
+===DONE===
+--EXPECT--
+integer
+integer
+===DONE===
|
