From: o_gangrel at hotmail dot com
Operating system: Windows 98
PHP version: 5.0.0b1 (beta1)
PHP Bug Type: SQLite related
Bug description: SQLite_query() returning NULL, not FALSE

Description:
------------
I am using the configuration Apache/2.0.43 (Win32) PHP/5.0.0b1 with PHP as
a module of Apache.

When I make a query on a SQLite database with a not valid SQL query, the
the sqlite_query() produces an Warning, that's ok. But when the script
continues the SQLite_fetch_array() returns a NULL and it is expected to
return a FALSE.
The Warning message produced by the SQLite_fetch_array() is right, but the
return value is not expected.

I found solutions to not hapen this erro, but this is not expected.
And I'm sorry, I didn't tested the CVS version and other vertion of the
Apache.

Reproduce code:
---------------
$query1 = "SELECT * FROM sqlite_master";
$query2 = "foobar";
$db_file = "test.db";

$sqlite_connection = sqlite_open($db_file, 0666, $sqlite_error);
if($sqlite_connection === false) {
die($sqlite_error);
}

$result = sqlite_query($sqlite_connection, $query1);
echo var_dump(sqlite_fetch_array($result, SQLITE_BOTH))."\n";

$result = sqlite_query($sqlite_connection, $query2);
echo var_dump(sqlite_fetch_array($result, SQLITE_BOTH))."\n";

sqlite_close($sqlite_connection);

Expected result:
----------------
array(10) {
[0]=>
string(5) "table"
["type"]=>
string(5) "table"
[1]=>
string(4) "test"
["name"]=>
string(4) "test"
[2]=>
string(4) "test"
["tbl_name"]=>
string(4) "test"
[3]=>
string(1) "3"
["rootpage"]=>
string(1) "3"
[4]=>
string(24) "CREATE TABLE test (test)"
["sql"]=>
string(24) "CREATE TABLE test (test)"
}

bool(false)

Actual result:
--------------
array(10) {
[0]=>
string(5) "table"
["type"]=>
string(5) "table"
[1]=>
string(4) "test"
["name"]=>
string(4) "test"
[2]=>
string(4) "test"
["tbl_name"]=>
string(4) "test"
[3]=>
string(1) "3"
["rootpage"]=>
string(1) "3"
[4]=>
string(24) "CREATE TABLE test (test)"
["sql"]=>
string(24) "CREATE TABLE test (test)"
}


Warning: sqlite_query(): near "foobar": syntax error in
D:\internet\pages\sqlite\bugscript.php on line 16


Warning: sqlite_fetch_array() expects parameter 1 to be resource, boolean
given in D:\internet\pages\sqlite\bugscript.php on line 17

NULL

--
Edit bug report at [url]http://bugs.php.net/?id=25503&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=25503&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=25503&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=25503&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=25503&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=25503&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=25503&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=25503&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=25503&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=25503&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=25503&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=25503&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=25503&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=25503&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=25503&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=25503&r=gnused[/url]