#38156 [Opn->Fbk]: user aggregate function on empty select result
| From: | tony2001@php.net | Date: | Thu, 20 Jul 2006 07:28:06 +0000 |
| Subject: | #38156 [Opn->Fbk]: user aggregate function on empty select result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99658@lists.php.net to get a copy of this message | ||
ID: 38156
Updated by: tony2001@php.net
Reported By: delta_v at mail dot ru
-Status: Open
+Status: Feedback
Bug Type: SQLite related
Operating System: Windows 2000 Prof
PHP Version: 5.1.4
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2006-07-20 06:38:08] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38156&edit=1