Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Pdosqlite bug #251

Closed
wants to merge 26 commits into from

3 participants

@srgoogleguy

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

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

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

@srgoogleguy srgoogleguy closed this
@Majkl578

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
Commits on Apr 17, 2012
  1. @yohgaki
  2. @yohgaki

    Add NEWS

    yohgaki authored
Commits on Apr 24, 2012
  1. @srgoogleguy
Commits on May 2, 2012
  1. @srgoogleguy
Commits on May 10, 2012
  1. @srgoogleguy
Commits on May 12, 2012
  1. @srgoogleguy
Commits on May 22, 2012
  1. @srgoogleguy
Commits on Jun 6, 2012
  1. @srgoogleguy
Commits on Jul 19, 2012
  1. @srgoogleguy
  2. @srgoogleguy
Commits on Jul 23, 2012
  1. @srgoogleguy
Commits on Jul 31, 2012
  1. @srgoogleguy
Commits on Aug 6, 2012
  1. @srgoogleguy
Commits on Aug 16, 2012
  1. @srgoogleguy
Commits on Sep 11, 2012
  1. @srgoogleguy
Commits on Sep 14, 2012
  1. @srgoogleguy
Commits on Sep 19, 2012
  1. @srgoogleguy
Commits on Sep 30, 2012
  1. @srgoogleguy
Commits on Oct 19, 2012
  1. @srgoogleguy
Commits on Nov 17, 2012
  1. @srgoogleguy
Commits on Nov 26, 2012
  1. @srgoogleguy
Commits on Dec 8, 2012
  1. @srgoogleguy
Commits on Dec 24, 2012
  1. @srgoogleguy
Commits on Jan 2, 2013
  1. @srgoogleguy
Commits on Jan 6, 2013
  1. @srgoogleguy
  2. @srgoogleguy
This page is out of date. Refresh to see the latest.
Showing with 34 additions and 2 deletions.
  1. +26 −0 ext/pdo/tests/bug_63916.phpt
  2. +8 −2 ext/pdo_sqlite/sqlite_statement.c
View
26 ext/pdo/tests/bug_63916.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo')) die('skip');
+?>
+--FILE--
+<?php
+$num = 100004313234244; // notice this exceeds 32 bits
+$conn = new PDO('sqlite::memory:');
+$conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))');
+
+$stmt = $conn->prepare('insert into users (id, num) values (:id, :num)');
+$stmt->bindValue(':id', 1, PDO::PARAM_INT);
+$stmt->bindValue(':num', $num, PDO::PARAM_INT);
+$stmt->execute();
+
+$stmt = $conn->query('SELECT num FROM users');
+$result = $stmt->fetchAll(PDO::FETCH_COLUMN);
+
+var_dump($num,$result[0]);
+
+?>
+--EXPECT--
+int(100004313234244)
+string(15) "100004313234244"
View
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
}
} else {
convert_to_long(param->parameter);
- if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
- return 1;
+ if (LONG_MAX > 2147483647) {
+ if (SQLITE_OK == sqlite3_bind_int64(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
+ return 1;
+ }
+ } else {
+ if (SQLITE_OK == sqlite3_bind_int(S->stmt, param->paramno + 1, Z_LVAL_P(param->parameter))) {
+ return 1;
+ }
}
}
pdo_sqlite_error_stmt(stmt);
Something went wrong with that request. Please try again.