s9y v0.8 - sqlite query error (crashes) in fetchEntry
Posted: Fri Apr 29, 2005 1:22 am
I ran into a fatal glitch. After creating a category, the front page and, it appeared, any entry related lookups would cause Apache to die.
I traced it to this query, from serendipity_fetchEntry in include/functions_entries.inc.php, which results in the following sqlite error when using the command-line sqlite client:
Apache 1.3.33/PHP 4.3.10. sqlite for PHP is a lightly patched verions of 1.0.3 from PECL.
I changed the code in functions_entries.inc.php as follows, and it now appears to be working:
As far as I know the changed query should give identical results, according to the SQL language.
I'm not sure where the bug lies or if this change has consequences beyond what I can think of.
Code: Select all
[Thu Apr 28 16:07:15 2005] [notice] child pid 25185 exit signal Segmentation fault (11)
[25075] MMCACHE: PHP crashed on opline 40 of sqlite_query() at /home/httpd/us/include/db/sqlite.inc.php:116
Code: Select all
sqlite> SELECT ec.entryid, c.categoryid, c.category_name, c.category_description, c.category_icon, c.parentid FROM serendipity_category AS c LEFT JOIN serendipity_entrycat AS ec ON ec.categoryid = c.categoryid WHERE ec.entryid IN (2);
|1|Dreams|Dreams||0
sqlite: src/vdbe.c:4670: sqliteVdbeExec: Assertion `pSet->prev' failed.
Aborted
I changed the code in functions_entries.inc.php as follows, and it now appears to be working:
Code: Select all
280,281c280,281
< ON ec.categoryid = c.categoryid
< WHERE ec.entryid IN (" . implode(', ', $search_ids) . ")";
---
> WHERE ec.categoryid = c.categoryid
> AND ec.entryid IN (" . implode(', ', $search_ids) . ")";
I'm not sure where the bug lies or if this change has consequences beyond what I can think of.