freetag plugin generates SQL error
freetag plugin generates SQL error
Hi,
i'm using the freetag plugin and can see the following error in my database log:
2010-02-24 13:27:08 CET ERROR: syntax error at or near ")" at character 66
2010-02-24 13:27:08 CET STATEMENT: SELECT entryid, tag from serendipity_entrytags WHERE entryid IN () order by entryid, tag
In addition there's a nasty PHP warning, if i create a new blog posting. But i'm not not sure, if that's related:
Warning: Invalid argument supplied for foreach() in /www/blog/plugins/serendipity_event_microformats/serendipity_event_microformats.php on line 137
Warning: Invalid argument supplied for foreach() in /www/blog/plugins/serendipity_event_microformats/serendipity_event_microformats.php on line 251
i'm using the freetag plugin and can see the following error in my database log:
2010-02-24 13:27:08 CET ERROR: syntax error at or near ")" at character 66
2010-02-24 13:27:08 CET STATEMENT: SELECT entryid, tag from serendipity_entrytags WHERE entryid IN () order by entryid, tag
In addition there's a nasty PHP warning, if i create a new blog posting. But i'm not not sure, if that's related:
Warning: Invalid argument supplied for foreach() in /www/blog/plugins/serendipity_event_microformats/serendipity_event_microformats.php on line 137
Warning: Invalid argument supplied for foreach() in /www/blog/plugins/serendipity_event_microformats/serendipity_event_microformats.php on line 251
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: freetag plugin generates SQL error
Hi!
Hm, the first error should not occur. Are you using the most recent version of the plugin?
The same applies to the microformats plugin, are you using a recent version there as well?
In both places you mentioned, current versions check if the input data is an array or not...
Regards,
Garvin
Hm, the first error should not occur. Are you using the most recent version of the plugin?
The same applies to the microformats plugin, are you using a recent version there as well?
In both places you mentioned, current versions check if the input data is an array or not...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: freetag plugin generates SQL error
Yes, plugins are up to date, according to spartacus (i wrote this script which checks regularly for plugin updates). For what code should i look to find out, if the changes you mentioned are applied to my plugins?
Note that the database in question is PostgreSQL and the "()" really looks like empty values.
I remember, that i have seen the php warnings before, just the database error is new to me.
Note that the database in question is PostgreSQL and the "()" really looks like empty values.
I remember, that i have seen the php warnings before, just the database error is new to me.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: freetag plugin generates SQL error
Hi!
The first one would be in serendipity_event_freetag.php at around line 1456. The code says:
So if $entries is empty, it should bail out due to the is_array check at the beginning.
You might want to modify it like this:
Then this would log possible empty strings and give the input array into the logfile /tmp/s9y.log (make sure you pick a file/dir thats writable).
Inside serendipity_event_microformats.php there's a similar thing. The actual error happens in the "getSupportedProperties()" method. This is called with an input parameter called "mf_type".
But all references to this really specify a proper input array:
line 165:
line 234:
line 250:
line 288:
Which PHP version are you running? Some PHP versions had a bug when a bytecode cache was used that did not properly pass along arrays...
Regards,
Garvin
The first one would be in serendipity_event_freetag.php at around line 1456. The code says:
Code: Select all
function getTagsForEntries($entries) {
global $serendipity;
if (!is_array($entries) || count($entries) < 1) {
return false;
}
$q = "SELECT entryid, tag from {$serendipity['dbPrefix']}entrytags WHERE entryid IN (".implode(',', $entries).") order by entryid, tag";
You might want to modify it like this:
Code: Select all
function getTagsForEntries($entries) {
global $serendipity;
if (!is_array($entries) || count($entries) < 1) {
return false;
}
$string = implode(',', $entries);
$string = trim($string);
if (empty($string)) { $fp = fopen('/tmp/s9y.log', 'a'); fwrite($fp, print_r($entries, true)); fclose($fp); }
$q = "SELECT entryid, tag from {$serendipity['dbPrefix']}entrytags WHERE entryid IN (".implode(',', $entries).") order by entryid, tag";
Inside serendipity_event_microformats.php there's a similar thing. The actual error happens in the "getSupportedProperties()" method. This is called with an input parameter called "mf_type".
But all references to this really specify a proper input array:
line 165:
Code: Select all
$supported_formats = array('hReview', 'hCalendar');
$supported_properties =& $this->getSupportedProperties($supported_formats);
Code: Select all
$supported_formats = array('hReview', 'hCalendar');
$supported_properties =& $this->getSupportedProperties($supported_formats);
Code: Select all
if (is_array($serendipity['POST']['properties']) && count($serendipity['POST']['properties']) > 0){
$supported_properties =& $this->getSupportedProperties($serendipity['POST']['properties']['mf_type']);
Code: Select all
$supported_formats = array('hReview', 'hCalendar');
$supported_properties =& $this->getSupportedProperties($supported_formats);
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: freetag plugin generates SQL error
First of all, before i try to debug and add your code:
I found two serendipity_event_freetag.php files:
./plugins/freetag/serendipity_event_freetag.php
./plugins/serendipity_event_freetag/serendipity_event_freetag.php
The first one is:
$Id: serendipity_event_freetag.php,v 1.124 2008/12/10 10:34:52 lstrojny Exp $
The second one is:
$Id: serendipity_event_freetag.php,v 1.136 2010/01/06 23:37:08 onli Exp $
Is this correct? If no, which one should i remove, if yes: which one should i add your debugging code?
I found two serendipity_event_freetag.php files:
./plugins/freetag/serendipity_event_freetag.php
./plugins/serendipity_event_freetag/serendipity_event_freetag.php
The first one is:
$Id: serendipity_event_freetag.php,v 1.124 2008/12/10 10:34:52 lstrojny Exp $
The second one is:
$Id: serendipity_event_freetag.php,v 1.136 2010/01/06 23:37:08 onli Exp $
Is this correct? If no, which one should i remove, if yes: which one should i add your debugging code?
Re: freetag plugin generates SQL error
Which one gets used? The one in /plugins/serendipity_event_freetag/ is newer and should be the only one.
sincerely
sincerely
Re: freetag plugin generates SQL error
Both contain the array checks which garvin posted earlier in this thread.
I don't know which one get's used - and/or if the other one get's used if i remove one.
Which one is the official one?
I don't know which one get's used - and/or if the other one get's used if i remove one.
Which one is the official one?
Re: freetag plugin generates SQL error
The one in /plugins/serendipity_event_freetag/ is the official one, it's the one in spartacus.
Re: freetag plugin generates SQL error
I moved away the "freetag" directory and added some debugging code. From what i can see, this happens if i press the "preview" button:
Code: Select all
empty array: Array
(
[0] =>
)
query string:
SELECT entryid, tag from serendipity_entrytags WHERE entryid IN () order by entryid, tag
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: freetag plugin generates SQL error
Hi!
Ah, great. In fact we didn't check for that, thanks for helping the debugging. I committed a patch to the freetag plugin so that this case will now also be checked.
Regards,
Garvin
Ah, great. In fact we didn't check for that, thanks for helping the debugging. I committed a patch to the freetag plugin so that this case will now also be checked.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: freetag plugin generates SQL error
Ah, fine
I will wait for the module update and then check again if the php warnings are gone.
Andreas
I will wait for the module update and then check again if the php warnings are gone.
Andreas
Re: freetag plugin generates SQL error
Ok, the SQL bug is gone.
There is still the PHP warning:
In addition, the microformats output is buggy:
http://base.wars-nicht.de/microformats_2010-02-28.jpg
Short PHP tags are NOT allowed on this host
There is still the PHP warning:
Code: Select all
Warning: Invalid argument supplied for foreach() in /www/blog/plugins/serendipity_event_microformats/serendipity_event_microformats.php on line 137
Warning: Invalid argument supplied for foreach() in /www/blog/plugins/serendipity_event_microformats/serendipity_event_microformats.php on line 251
http://base.wars-nicht.de/microformats_2010-02-28.jpg
Short PHP tags are NOT allowed on this host
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: freetag plugin generates SQL error
Hi!
I removed the short-open required code in the latest version, maybe this can also corret your problem with the line 137/251 bug?
Regards,
Garvin
I removed the short-open required code in the latest version, maybe this can also corret your problem with the line 137/251 bug?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: freetag plugin generates SQL error
Version 3.10.4 is installed here. Should there be a newer version?
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: freetag plugin generates SQL error
Hi!
Regards,
Garvin
I'm talking about Microformats, there 0.44 is the now recent versionads wrote:Version 3.10.4 is installed here. Should there be a newer version?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/