Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Pdosqlite bug #251

Closed
wants to merge 26 commits into from

3 participants

Sherif Ramadan Michael Moravec Yasuo Ohgaki
Sherif Ramadan

Fixes Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite.

yohgaki and others added some commits
Yasuo Ohgaki yohgaki Implement Request #47570 libpq's PG_VERSION should be exported to use…
…rland
b906cb1
Yasuo Ohgaki yohgaki Add NEWS 67ba121
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 9016c34
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 abfdc4b
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 815251d
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 e06c6a1
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 34238d6
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 0b634e6
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 ca88c14
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of github.com:srgoogleguy/php-src into PHP-5.4 f0f1d78
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 a19c7cd
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 eb1d6df
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 1347323
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 2c218d2
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 bc9fc08
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 26941b6
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 98ddd78
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 3ab3d3a
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 a746171
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 d2556ec
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 1a99612
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 4d9f30c
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of https://github.com/php/php-src into PHP-5.4 da89b65
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of https://github.com/php/php-src into PHP-5.4 e9615f5
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of https://github.com/php/php-src into PHP-5.4 c46ba56
Sherif Ramadan srgoogleguy Fixes Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on…
… 64bit builds in pdo_sqlite.
91737e3
Sherif Ramadan

My bad this git log is messed up. Let me resubmit properly so it does have all these weird commits in the PR.

Michael Moravec

You don't need to re-submit it. Just rebase (or whatever) & force-push into the same branch, it will update commits here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 26 unique commits by 3 authors.

Apr 17, 2012
Yasuo Ohgaki yohgaki Implement Request #47570 libpq's PG_VERSION should be exported to use…
…rland
b906cb1
Yasuo Ohgaki yohgaki Add NEWS 67ba121
Apr 24, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 9016c34
May 02, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 abfdc4b
May 10, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 815251d
May 12, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 e06c6a1
May 22, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 34238d6
Jun 06, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 0b634e6
Jul 19, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 ca88c14
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of github.com:srgoogleguy/php-src into PHP-5.4 f0f1d78
Jul 23, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 a19c7cd
Jul 31, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 eb1d6df
Aug 06, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 1347323
Aug 16, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 2c218d2
Sep 11, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 bc9fc08
Sep 14, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 26941b6
Sep 19, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 98ddd78
Sep 30, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 3ab3d3a
Oct 19, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 a746171
Nov 17, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 d2556ec
Nov 26, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 1a99612
Dec 08, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of git://github.com/php/php-src into PHP-5.4 4d9f30c
Dec 24, 2012
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of https://github.com/php/php-src into PHP-5.4 da89b65
Jan 02, 2013
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of https://github.com/php/php-src into PHP-5.4 e9615f5
Jan 06, 2013
Sherif Ramadan srgoogleguy Merge branch 'PHP-5.4' of https://github.com/php/php-src into PHP-5.4 c46ba56
Sherif Ramadan srgoogleguy Fixes Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on…
… 64bit builds in pdo_sqlite.
91737e3
This page is out of date. Refresh to see the latest.
26 ext/pdo/tests/bug_63916.phpt
... ... @@ -0,0 +1,26 @@
  1 +--TEST--
  2 +Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite
  3 +--SKIPIF--
  4 +<?php
  5 +if (!extension_loaded('pdo')) die('skip');
  6 +?>
  7 +--FILE--
  8 +<?php
  9 +$num = 100004313234244; // notice this exceeds 32 bits
  10 +$conn = new PDO('sqlite::memory:');
  11 +$conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))');
  12 +
  13 +$stmt = $conn->prepare('insert into users (id, num) values (:id, :num)');
  14 +$stmt->bindValue(':id', 1, PDO::PARAM_INT);
  15 +$stmt->bindValue(':num', $num, PDO::PARAM_INT);
  16 +$stmt->execute();
  17 +
  18 +$stmt = $conn->query('SELECT num FROM users');
  19 +$result = $stmt->fetchAll(PDO::FETCH_COLUMN);
  20 +
  21 +var_dump($num,$result[0]);
  22 +
  23 +?>
  24 +--EXPECT--
  25 +int(100004313234244)
  26 +string(15) "100004313234244"
10 ext/pdo_sqlite/sqlite_statement.c
@@ -112,8 +112,14 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
112 112 }
113 113 } else {
114 114 convert_to_long(param->parameter);
115   - if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
116   - return 1;
  115 + if (LONG_MAX > 2147483647) {
  116 + if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
  117 + return 1;
  118 + }
  119 + } else {
  120 + if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
  121 + return 1;
  122 + }
117 123 }
118 124 }
119 125 pdo_sqlite_error_stmt(stmt);

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.