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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
50 + 2 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC