|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-24 08:16 UTC] dangerousdave86 at hotmail dot com
[2005-07-24 09:42 UTC] dangerousdave86 at hotmail dot com
[2005-07-24 09:59 UTC] dangerousdave86 at hotmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 16:00:01 2025 UTC |
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