bug in setPluginInfo and postgresql

Found a bug? Tell us!!
Post Reply
dmg

bug in setPluginInfo and postgresql

Post by dmg »

The insert into the table _pluginlist tries to insert an empty string instead of an integer when there is no local file for the corresponding plugin.
(the field last_modified). It might be a difference between postgresql and mysql.

I have fixed it by doing the following. I added the following code:

Code: Select all


[dmg@ti include]$ diff plugin_api.inc.php plugin_api.inc.php~
470,476d469
<
<         if (isset($pluginFile)) {
<           $lastModified = 0;filemtime($pluginFile);
<         } else {
<           $lastModified = 0;
<         }
<
492c485
<                 'last_modified'   => $lastModified
---
>                 'last_modified'   => filemtime($pluginFile)

garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: bug in setPluginInfo and postgresql

Post by garvinhicking »

Hi dmg!

Many thanks for spotting this! I've just committed your fix to SVN!

Best 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/
dmg

Re: bug in setPluginInfo and postgresql

Post by dmg »

I just realized I made a mistake in the fix:

Code: Select all


[dmg@ti include]$ diff plugin_api.inc.php plugin_api.inc.php~
470,476d469
<
<         if (isset($pluginFile)) {
<           $lastModified = 0;filemtime($pluginFile);
                            ^^
please remove the 0;
What an ugly cut-and-paste bug! Sorry.

dmg
dmg

Re: bug in setPluginInfo and postgresql

Post by dmg »

dmg wrote:I just realized I made a mistake in the fix:

Code: Select all


[dmg@ti include]$ diff plugin_api.inc.php plugin_api.inc.php~
470,476d469
<
<         if (isset($pluginFile)) {
<           $lastModified = 0;filemtime($pluginFile);
                            ^^
please remove the 0;
What an ugly cut-and-paste bug! Sorry.

dmg
Well, that did not seem to fix it: the fix is just to add (int) in front of filemtime:
replace, in the original code:

Code: Select all

             last_modified'   => filemtime($pluginFile)

with
             'last_modified'   => (int)filemtime($pluginFile)

dmg
Post Reply