|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #61661 SQLite3::createAggregate() callbacks: insufficient docs
Submitted: 2012-04-07 20:25 UTC Modified: 2018-09-22 10:41 UTC
From: xelloss at hotmail dot it Assigned: cmb (profile)
Status: Closed Package: SQLite related
PHP Version: 5.3.10 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: xelloss at hotmail dot it
New email:
PHP Version: OS:


 [2012-04-07 20:25 UTC] xelloss at hotmail dot it
From manual page:
I'm trying to use the aggregate function of sqlite3class and also in pdo.
I try to use the same code from SQLiteDatabase (, changed for work with these two function.
But the variable context is always empty.
See code below for example.
I can declare a global variable context, but it will be used always (everytime it start with last value and if I use the aggregate function more than 1 time in a query the variable became shared)

Test script:
$data = array(

$dbhandle = new SQLite3(':memory:');
$dbhandle->exec("CREATE TABLE strings(a)");
foreach ($data as $str) {
    $str = sqlite_escape_string($str);
    $dbhandle->exec("INSERT INTO strings VALUES ('$str')");

function max_len_step(&$context, $string)
	echo "-" . $context;
	echo "<br>";
    if (strlen($string) > $context) {
        $context = strlen($string);

function max_len_finalize(&$context)
    return $context;

$dbhandle->createAggregate('max_len', 'max_len_step', 'max_len_finalize');

$rs = $dbhandle->query('SELECT max_len(a) from strings');

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-01 12:38 UTC]
-Package: PDO related +Package: PDO SQLite
 [2018-09-22 10:22 UTC]
-Summary: Error in aggreagate function in PDO or Sqlite3 +Summary: SQLite3::createAggregate() callbacks: insufficient docs -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Package: PDO SQLite +Package: SQLite related -Assigned To: +Assigned To: cmb
 [2018-09-22 10:22 UTC]
This works as expected, but certainly the documentation of
SQLite3::createAggregate() and friends needs improvement regarding
the callbacks.
 [2018-09-22 10:40 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix #61661: SQLite3::createAggregate() callbacks: insufficient docs
 [2018-09-22 10:41 UTC]
-Status: Verified +Status: Closed
 [2018-09-22 10:41 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC]
Automatic comment on behalf of cmb
Log: Fix #61661: SQLite3::createAggregate() callbacks: insufficient docs
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jul 26 05:01:23 2021 UTC