Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: Bug in article deletion?  (Read 6634 times)

invarbrass

  • Full Member
  • ***
  • Karma: 18
  • Posts: 117
    • http://snews.extremebittorrent.com
Bug in article deletion?
« on: January 24, 2008, 03:53:45 PM »

While porting the SQL statments to SQLite syntax, I came upon this. After an article is deleted, the following query is executed for the comments table:
Code: [Select]
mysql_query("DELETE FROM ".db('prefix')."comments WHERE articleid = $id LIMIT 1;");
The LIMIT statement is clearly a bug. What if the article has more than 1 comments? Does it mean that these orphanned comments lurk there forever, corrupting the database integrity? Database engines like SQLite sometimes recycle primary keys. It may so happen that these orphanned comments later gets 'parented' by a different article?

Need feedbacks.
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: Bug in article deletion?
« Reply #1 on: January 24, 2008, 04:27:34 PM »

Hello,
I found curious this week too that when you decide to unpublish an article the associated comments are still published (but this might comes from my Modded sNews).

Joost

  • Guest
Re: Bug in article deletion?
« Reply #2 on: January 25, 2008, 02:26:09 AM »

Both bug reports confirmed.

For db integrity, the solution is simple. Replace

Code: [Select]
mysql_query("DELETE FROM ".db('prefix')."comments WHERE articleid = $id LIMIT 1;");with
Code: [Select]
mysql_query("DELETE FROM ".db('prefix')."comments WHERE articleid = $id ;");
« Last Edit: January 25, 2008, 02:36:48 AM by Joost »
Logged

henrich

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 381
  • Passion for quality and excellence!
    • My personal blog and portofolio
Re: Bug in article deletion?
« Reply #3 on: January 25, 2008, 02:57:28 AM »

Yeah good point  ;D, i just want to tell you mates, that i am building my blog on the ML version and after i add every MOD i test it very detailed, so i suggest you to do the same thing, so you have more chances that in the future you will not have any problems :) Cheers Sven :)
Logged
By(e) Henrich :)
------------------------------
IT related blog

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: Bug in article deletion?
« Reply #4 on: January 25, 2008, 08:19:02 AM »

Sven was there to say Hello. Insect has been squashed.

Joost

  • Guest
Re: Bug in article deletion?
« Reply #5 on: January 25, 2008, 05:08:42 PM »

Sven was there to say Hello. Insect has been squashed.

I didn't find a solution for your bug Philippe. So I suggest to put the bug in a jar, together with a wasp and a spider and find out who eats who.
Logged

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
Re: Bug in article deletion?
« Reply #6 on: January 25, 2008, 06:15:25 PM »

 ;D

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Bug in article deletion?
« Reply #7 on: July 17, 2008, 06:15:04 PM »

Sven was there to say Hello. Insect has been squashed.

I didn't find a solution for your bug Philippe. So I suggest to put the bug in a jar, together with a wasp and a spider and find out who eats who.

The wasp eat the spider! I can prove ;D
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Bug in article deletion?
« Reply #8 on: July 17, 2008, 09:09:25 PM »

And a FIX for this bug is now posted here.
(Update: July 23.08) This fix has since been added to the current Official sNews16 Download package.
« Last Edit: July 23, 2008, 07:17:47 PM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Bug in article deletion?
« Reply #9 on: July 23, 2008, 08:12:33 PM »

Sir,
There are still bugs in download package. Bugs signaled here (I observed first in 1.7RC version) http://snewscms.com/forum/index.php?topic=7300.msg51676#msg51676 .

Try to edit or delete a comment posted to an article which is published under a different category than home. You will get a wrong back link after the operation has been completed. I posted also the solution but if here can be another better solution, is ok.

And I don't know if security patch about captcha will be applied to download package....
« Last Edit: July 23, 2008, 08:16:17 PM by funlw65 »
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Bug in article deletion?
« Reply #10 on: July 24, 2008, 03:17:37 AM »

Sir,
There are still bugs in download package. Bugs signaled here (I observed first in 1.7RC version) http://snewscms.com/forum/index.php?topic=7300.msg51676#msg51676 .

1 - Try to edit or delete a comment posted to an article which is published under a different category than home. You will get a wrong back link after the operation has been completed. I posted also the solution but if here can be another better solution, is ok.

2 - And I don't know if security patch about captcha will be applied to download package....

1 - See my answer over in that topic.
2 - It isn't posted in this BUGS board... is it?
Please leave discussion here in this topic to "Article Deletion" issues..
« Last Edit: July 24, 2008, 03:21:11 AM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU