ID: 33844
User updated by: dangerousdave86 at hotmail dot com
Reported By: dangerousdave86 at hotmail dot com
-Status: Open
+Status: Closed
Bug Type: Reproducible crash
Operating System: Windows XP Pro SP1
PHP Version: 5.1.0b3
New Comment:
I upgraded my PHP with php5-win32-latest.zip and the problems have
disapeared, keep up the good work, PHP5.1 will be done in no time.
Sorry for the useless post.
Previous Comments:
------------------------------------------------------------------------
[2005-07-24 09:42:09] dangerousdave86 at hotmail dot com
I have worked out a work around, so that I can continue developing with
my current setup. Doing a SELECT COUNT (*) WHERE [criteria], will return
0 for SELECTs that would normaly return 0 rows and crash Apache2.
I may also test to see if this happens with Apache1, but for now I can
continue development.
------------------------------------------------------------------------
[2005-07-24 08:16:16] dangerousdave86 at hotmail dot com
Decided to create reproduce code in the end.
------------------------------------------------------------------------
[2005-07-24 08:14:07] dangerousdave86 at hotmail dot com
Description:
------------
When I query an SQLite database through PHP5.1.0b3's PDO functions on
Apache2.0.54, everything appears fine. This is until I query the
database with a SELECT that matches no rows. What I mean by this is
that when I do a SELECT with criteria I know will match DB rows, it
returns the rows nicely. When I query the DB using a criteria I know
will not match any rows in the database, PHP stops at the $PDO->Query
call and Apache crashes.
Apache Crash data: Faulting application Apache.exe, version 2.0.54.0,
faulting module php5ts.dll, version 5.1.0.0, fault address 0x00008034.
I have not attempted to reproduce this bug outside of my current
project, if this would help I can do it. But to reproduce I think all
is necersary is to run a select on an SQLite Database that will not
return any rows.
I know that I have not coded this problem myself, as when I swap to the
MySQL PDO driver, there are no issues whatsoever.
The current goal of my PHP project is to migrate to SQLite from MySQL,
and this bug is standing right in the way of doing so. So until it is
fixed I am kind of stuck.
Any feedback would be appreciated, I'll do my best to help anyone who
tries to find the problem.
Reproduce code:
---------------
<?php
// Reproduce SQLite bug
// Assumes file permissions are good
if (file_exists ('database1.db')) unlink ('database1.db');
// Create the new PDO object
$PDO = new PDO ('sqlite:database1.db');
// Fill the database with test data
$PDO->query ('CREATE TABLE "test_table" ( "test_index" INTEGER NOT
NULL PRIMARY KEY AUTOINCREMENT, "test_data" TEXT NOT NULL default
"")');
for ($i = 1; $i <= 10; $i++) $PDO->query ('INSERT INTO test_table
("test_data") VALUES ("value '.$i.'")');
// Possible die here to stop and check the database worked using
SQLite3.exe from sqlite.org
// die;
$query_match = 'SELECT * FROM test_table WHERE test_data = "value 5"';
$query_nomatch = 'SELECT * FROM test_table WHERE test_data = "value
100"';
// Run working query
$PDOStatement = $PDO->query ($query_match);
$results = $PDOStatement->fetchAll (PDO_FETCH_ASSOC);
file_put_contents ('debug.txt',print_r ($results, TRUE), FILE_APPEND);
// Run non-working query
$PDOStatement = $PDO->query ($query_nomatch);
// The program will never get to here
$results = $PDOStatement->fetchAll (PDO_FETCH_ASSOC);
file_put_contents ('debug.txt',print_r ($results, TRUE), FILE_APPEND);
?>
Expected result:
----------------
I would expect this script to just execute, outputing a blank page and
a text file with some information in it.
Actual result:
--------------
Apache crashes
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33844&edit=1