diff -ru php/include/db.inc.php php.fixed/include/db.inc.php --- php/include/db.inc.php 2011-09-28 05:13:58.000000000 -0400 +++ php.fixed/include/db.inc.php 2011-10-27 18:09:48.000000000 -0400 @@ -179,7 +179,7 @@ if(file_exists($DB['DATABASE'])){ - $DB['DB']= sqlite3_open($DB['DATABASE']); + $DB['DB'] = new SQLite3($DB['DATABASE']); if(!$DB['DB']){ $error = 'Error connecting to database'; $result = false; @@ -222,8 +222,7 @@ $result = db2_close($DB['DB']); break; case 'SQLITE3': - $result = true; - sqlite3_close($DB['DB']); + $result = $DB['DB']->close(); free_db_access(); break; default: break; @@ -491,13 +490,13 @@ $query .= ' LIMIT '.intval($limit).' OFFSET '.intval($offset); } - if(!$result = sqlite3_query($DB['DB'],$query)){ + if(!$result = $DB['DB']->query($query)){ error('Error in query ['.$query.'] ['.sqlite3_error($DB['DB']).']'); } else{ $data = array(); - while($row = sqlite3_fetch_array($result)){ + while($row = $results->fetchArray(SQLITE3_ASSOC)){ foreach($row as $id => $name){ if(!zbx_strstr($id,'.')) continue; $ids = explode('.',$id); @@ -507,7 +506,7 @@ $data[] = $row; } - sqlite3_query_close($result); + $result->finalize(); $result = &$data; } @@ -583,9 +582,9 @@ lock_db_access(); } - $result = sqlite3_exec($DB['DB'], $query); + $result = $DB['DB']->exec($query); if(!$result){ - error('Error in query ['.$query.'] ['.sqlite3_error($DB['DB']).']'); + error('Error in query ['.$query.'] ['.$DB['DB']->lastErrorMsg().']'); } if(!$DB['TRANSACTIONS']){ diff -ru php/include/requirements.inc.php php.fixed/include/requirements.inc.php --- php/include/requirements.inc.php 2011-09-28 05:13:58.000000000 -0400 +++ php.fixed/include/requirements.inc.php 2011-10-27 17:55:41.000000000 -0400 @@ -257,13 +257,7 @@ $current[] = BR(); } - if(function_exists('sqlite3_open') && - function_exists('sqlite3_close') && - function_exists('sqlite3_query') && - function_exists('sqlite3_error') && - function_exists('sqlite3_fetch_array') && - function_exists('sqlite3_query_close') && - function_exists('sqlite3_exec')){ + if(class_exists('SQLite3')){ $current[] = 'SQLite3'; $current[] = BR(); diff -ru php/setup.php php.fixed/setup.php --- php/setup.php 2011-09-28 05:14:01.000000000 -0400 +++ php.fixed/setup.php 2011-10-27 18:11:57.000000000 -0400 @@ -106,7 +106,7 @@ } // SQLITE3 - if(zbx_is_callable(array('sqlite3_open', 'sqlite3_close', 'sqlite3_query', 'sqlite3_error', 'sqlite3_fetch_array', 'sqlite3_query_close', 'sqlite3_exec'))){ + if(class_exists('SQLite3')){ $ZBX_CONFIG['allowed_db']['SQLITE3'] = 'SQLite3'; }