bug63921-32bit.phpt 764 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #63921 sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API
  3. --EXTENSIONS--
  4. sqlite3
  5. --SKIPIF--
  6. <?php
  7. if (PHP_INT_SIZE > 4) die('skip 32-bit only'); // skip for 64bit builds - there is another test for that
  8. ?>
  9. --FILE--
  10. <?php
  11. $num = PHP_INT_MAX; // 32 bits
  12. $conn = new sqlite3(':memory:');
  13. $conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))');
  14. $stmt = $conn->prepare('insert into users (id, num) values (:id, :num)');
  15. $stmt->bindValue(':id', 1, SQLITE3_INTEGER);
  16. $stmt->bindValue(':num', $num, SQLITE3_INTEGER);
  17. $stmt->execute();
  18. $stmt = $conn->query('SELECT num FROM users');
  19. $result = $stmt->fetchArray();
  20. var_dump($num,$result[0]);
  21. ?>
  22. --EXPECT--
  23. int(2147483647)
  24. int(2147483647)