php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38156 user aggregate function on empty select result
Submitted: 2006-07-20 06:38 UTC Modified: 2006-07-28 01:00 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: delta_v at mail dot ru Assigned:
Status: No Feedback Package: SQLite related
PHP Version: 5.1.4 OS: Windows 2000 Prof
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: delta_v at mail dot ru
New email:
PHP Version: OS:

 

 [2006-07-20 06:38 UTC] delta_v at mail dot ru
Description:
------------
user aggregate function on empty select result
Apache crach


Reproduce code:
---------------
function actstep(&$context,$tau,$val) {
   if ($conext[0]<$tau) { $conext[0]=$tau; $context[1]=$val; }
   }
function actfin(&$context) {
   return $context[1];
   }
$f = 'tmp.sqlt';
unlink($f);
$h = sqlite_open($f);
sqlite_exec($h,"CREATE TABLE lnk(obj,atr,tau,val)");
sqlite_exec($h,"INSERT INTO lnk VALUES(1,1,2,5)");
sqlite_exec($h,"INSERT INTO lnk VALUES(1,1,5,10)");
sqlite_create_aggregate($h,'actual','actstep','actfin');

// This work:
$r1 = sqlite_array_query($h,"SELECT actual(tau,val) FROM lnk WHERE obj=1 AND atr=1 AND tau<=10",SQLITE_NUM);
// When empty result set Apache crach: 
$r2 = sqlite_array_query($h,"SELECT actual(tau,val) FROM lnk WHERE obj=2 AND atr=1 AND tau<=10",SQLITE_NUM);
var_dump($r1);
var_dump($r2);


Expected result:
----------------
array(1) { [0]=> array(1) { [0]=> string(2) "10" } }
null 

Actual result:
--------------
Crach

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-20 07:28 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-07-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 09:01:29 2025 UTC