Skip to content

SQLite createFunction corrupts large integers #25021

Open

Description

@mvorisek

Description

The following code:

<?php

$db = new PDO('sqlite::memory:');

$db->sqliteCreateFunction('cust', function ($v) {
    var_dump($v);
    
    return $v;
}, 1);

$sth = $db->prepare('SELECT 1234000000000 direct, cust(1234000000000) fx');
$sth->execute();

$result = $sth->fetch(PDO::FETCH_ASSOC);
var_dump($result);

Resulted in this output:

int(1344386048)
array(2) {
  ["direct"]=>
  int(1234000000000)
  ["fx"]=>
  int(1344386048)
}

But I expected this output instead:

int(1234000000000)
array(2) {
  ["direct"]=>
  int(1234000000000)
  ["fx"]=>
  int(1234000000000)
}

Please fix at the lowest branch possible as there is no client workaround.

PHP Version

any

Operating System

any

Activity

  1. mvorisek commented on Oct 28, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions