Same Trackback is accepted twice..

Found a bug? Tell us!!
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Same Trackback is accepted twice..

Post by blog.brockha.us »

I still use internal trackbacks, I'm not sure if I will stay with this. But today I recognized again, that the same trackback is accepted twice.

It happened after resaving an article containig a link to an older entry (linked via the wikify plugin). The first bug is, that this trackback is sent twice by my blog.

But the other bug is, that trackbacks are accepted twice. Any ideas? Is this perhaps only a problem with internal trackbacks? Or only with the wikify plugin? Or is this somehow general?

Somebody else watched this problem?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Same Trackback is accepted twice..

Post by garvinhicking »

Hi!

s9y does not check if trackbacks with the same body and title are already existing. It silently accepts all trackbacks (into the moderation queue, if you use that).

Could it be that you changed your entry from draft to publish and back again? This will re-execute sending trackbacks.

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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

Hmm.. Maybe.. I'm not sure, what produced this strange double sending of the same trackback. I have to watch that a little more exact..

But accepting the same trackback twice, is an error, isn't it? The pingback specification even defines a special error code 48 for this situation. I think, trackback should act the same. Or can you think of a situation, where two trackbacks with same source and target should be accepted? The optimal way would be, if the second trackback would overwrite the former, as there might be some change in the other meta information. Pingback only rejects this with a defined errorcode.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Well...since s9y only supported trackbacks for the most time, I don't really know if the trackback specification lists that no trackback should be added twice.... :-)

Two trackbacks might make sense if I update my entry with a different lead-in text?

However, in the 5 years of blogging in reality it never occurred to me that I saw 2 trackbacks on any s9y blog. ;)

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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

I havn't even seen a trackback specification yet. Anybody? :-)
Two trackbacks might make sense if I update my entry with a different lead-in text?
This is the "different metainfo" situation, I mentioned above. This shouldn't lead into a second trackback but into an update of the old one, I think.
However, in the 5 years of blogging in reality it never occurred to me that I saw 2 trackbacks on any s9y blog. Wink
In my first week of blogging I had it at least twice.. :wink: In all cases this was produced by internal links not by external trackback requests, so this should be no problem yet.

But as a SPAMMER I would try to add the same trackback as often as I am allowed to. Pingback rejects this, the s9y trackbacker would add all of them to the database..

Perhaps I will add an update mechanism to the trackback adding code, if I find time for it.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
blog.brockha.us wrote:I havn't even seen a trackback specification yet. Anybody? :-)
http://www.sixapart.com/pronet/docs/trackback_spec ?
In my first week of blogging I had it at least twice.. :wink: In all cases this was produced by internal links not by external trackback requests, so this should be no problem yet.
The spamblock plugin has an option to prevent comments (and trackbacks) that have the same content...maybe this is why I never experienced duplicate TBs...?

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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

Thanks for the specification link, I was to lazy to search.

And do you mean the "deny dupe comments" option in the spam block plugin? This is sitched on at my side, too... I didn't find a seperate "deny dupe trackbacks" option, so it has to be that, hasn't it?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

I found a situation, where s9y tries to send a pingback/trackback again and again, any time I save the article.

This article is producing this.

In this article the site http://www.simpsonsmovie.com/ is linked twice. Once in the articles text and second as link for the image. The database already holds this link twice for this entry.

In this situation any time I resave this article, s9y tries to pingback again. For luck the linked site doesn't support pingback or trackback. Any ideas or should I investigate the problem?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Is it just the pingback or the trackback that gets re-executed? If its pingback, it could be related to the latest changes to the code?

Because for trackback, s9y looks up the serendipity_references DB table and if it finde the link there already, it will skip sending trackbacks to that link?!

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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

It's for both. The method serendipity_reference_autodiscover seems to be called again (and therfor pingback and trackback are called again).

As far as I understand, the lookup mechanism is not special for trackback but for reference. So it can't be related to the last changes, as the lookup is done before even calling serendipity_reference_autodiscover. Right?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I think you'Re right, yes. TB and PB should be the same then.

Hm, but I can't reproduce this here on my installation. Maybe it's some other event plugin interfering?

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/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

Okay, I will have a closer look.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

Well, it doesn't seem to relate to the double link, it is with any article having a link behind a picture, even if this picture is linking to it's full variant.. This link is saved in the references table, too, but processed again everytime I resave..

I have to look into the code, what is happening there..
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Post by blog.brockha.us »

Phew! This was a hard one to debug! :-)

The problem is related to the following part of code in functions_trackback.inc in method serendipity_handle_references. If an image is found inside of a link, the ALT attribute is saved as name for the link into the database:

Code: Select all

        if (preg_match_all('@<img[^>]+?alt=["\']?([^\'">]+?)[\'"][^>]+?>@i', $names[$i], $img_alt)) {
            if (is_array($img_alt) && is_array($img_alt[0])) {
                foreach($img_alt[0] as $alt_idx => $alt_img) {
                    // Replace all <img>s within a link with their respective ALT tag, so that references
                    // can be stored with a title.
                    $names[$i] = str_replace($alt_img, $img_alt[1][$alt_idx], $names[$i]);
                }
            }
        }
But my images doesn't have an ALT attribute, so the link is saved with an empty name, what doesn't seem to be recognized by the checking for already processed links.

After adding directly below this code this new code, the image link is only checked once:

Code: Select all

        else
        if (preg_match_all('@<img[^>]+?src=["\']?([^\'">]+?)[\'"][^>]+?>@i', $names[$i], $img_alt)) {
            if (is_array($img_alt) && is_array($img_alt[0])) {
                foreach($img_alt[0] as $alt_idx => $alt_img) {
                    // Replace all <img>s within a link with their respective ALT tag, so that references
                    // can be stored with a title.
                    $names[$i] = str_replace($alt_img, $img_alt[1][$alt_idx], $names[$i]);
                }
            }
        }
This code adds the SRC value as link name, if no ALT attribute was found.

But this leads to my next question: Why is it important, what the text inside the link is? In my opinion the text doesn't matter at all, only the link itself. At the moment each double link is checked (and trackbacked/pingbacked!), if only the encapsulated text/html is different. Shouldn't it be checked only once while beeing in one article? This is realy confusing me a little..
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

That's true. Rather than fixing it with this code, I believe the proper way would be to make the handle_references function be able to distinct unique links, regardless of their description?

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/
Post Reply