Subject: spotweb: crash in cron job
Package: spotweb
Version: 20111024~git0.5de06be6+dfsg-1
Severity: important
Tags: patch
Spotweb's cron job has been crashing with the following error:
SpotWeb v0.42.8.20 crashed
Fatal error occured retrieving messages:
Error executing query: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use near
'' at line 3
#0 /usr/share/spotweb/lib/dbeng/dbeng_abs.php(88): dbeng_mysql->rawExec('INSERT
INTO spo...')
#1 /usr/share/spotweb/lib/dbeng/dbeng_mysql.php(115): dbeng_abs->exec('INSERT
INTO spo...', Array)
#2 /usr/share/spotweb/lib/SpotDb.php(1297): dbeng_mysql->modify('INSERT INTO
spo...', Array)
#3 /usr/share/spotweb/lib/retriever/SpotRetriever_Spots.php(254):
SpotDb->addSpots(Array, Array)
#4 /usr/share/spotweb/lib/retriever/SpotRetriever_Abs.php(125):
SpotRetriever_Spots->process(Array, 1699179, 1700180)
#5 /usr/share/spotweb/scripts/retrieve.php(103):
SpotRetriever_Abs->loopTillEnd(1699179, 1000)
#6 {main}
Debugging this issue it seems that spotweb tries to do an INSERT without
any VALUES. Attached is a trivial patch with a fix.
I didn't do a very thorough analysis of the problem (it could be that
some other bug triggers this issue) but this patch fixes the issue for
me anyway.
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (900, 'testing'), (800, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 3.9-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages spotweb depends on:
ii apache2 2.2.22-13
ii apache2-mpm-prefork [apache2] 2.2.22-13
ii dbconfig-common 1.8.47+nmu1
ii debconf [debconf-2.0] 1.5.50
ii libapache2-mod-php5 5.4.4-15.1
ii libjs-jquery 1.7.2+dfsg-2
ii libjs-jquery-cookie 8-2
ii libjs-jquery-easing 8-2
ii libjs-jquery-fancybox 8-2
ii libjs-jquery-form 8-2
ii libjs-jquery-mousewheel 8-2
ii libjs-jquery-ui 1.10.1+dfsg-1
ii php-net-nntp 1.5.0-1
ii php5-curl 5.4.4-15.1
ii php5-gd 5.4.4-15.1
ii php5-gmp 5.4.4-15.1
ii php5-mysql 5.4.4-15.1
ii ttf-mscorefonts-installer [msttcorefonts] 3.5
ii ucf 3.0027+nmu1
Versions of packages spotweb recommends:
ii mysql-client-5.5 [mysql-client] 5.5.31+dfsg-1
ii mysql-server 5.5.31+dfsg-1
--
-- arthur - [email protected] - http://people.debian.org/~adejong --
--- /usr/share/spotweb/lib/SpotDb.php.orig 2013-07-25 22:18:35.000000000 +0200
+++ /usr/share/spotweb/lib/SpotDb.php 2013-07-25 22:19:22.000000000 +0200
@@ -1292,9 +1292,11 @@
} # foreach
# Actually insert the batch
- $this->_conn->modify("INSERT INTO spots(messageid, poster, title, tag, category, subcata,
+ if (!empty($insertArray)) {
+ $this->_conn->modify("INSERT INTO spots(messageid, poster, title, tag, category, subcata,
subcatb, subcatc, subcatd, subcatz, stamp, reversestamp, filesize)
- VALUES " . implode(',', $insertArray), array());
+ VALUES " . implode(',', $insertArray), array());
+ } # if
if (!empty($fullSpots)) {
$this->addFullSpots($fullSpots);