Entry disappeared after editing

Found a bug? Tell us!!
Post Reply
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Entry disappeared after editing

Post by onli »

An entry I wrote was alright. Then I edited it, i added an alt-tag to the image. After the edit, the entry is still visible on the frontpage, but "can't be found" when trying to view the entry directly.

Frontpage, entry.

I have no idea how to debug this as i never saw anything like that happen with s9y before. An id-mixup in the database caused by the edit? Wrong permalinks caused by the edit, a new one created but the old one still linked?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Entry disappeared after editing

Post by Timbalu »

Ich schätze mal das liegt daran, dass dein Titel mit einer Zahl anfängt...., denn
http://www.onli-blogging.de/index.php?/ ... l#comments
funktioniert. Wer da allerdings dazwischenfunkt, kann wohl am ehesten Garvin herausfinden

Ian

oops sorry für deutsch----
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Entry disappeared after editing

Post by onli »

Danke. Darauf wär ich nie gekommen.

It seems like not the edit is responsible but the number in the title is.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Entry disappeared after editing

Post by garvinhicking »

Hi!

You are missing a distinct entry URL "archives path" prefix like "entries". Since you don't have it, the URL pattern matches your URL as a ID of another entry...

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/
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Entry disappeared after editing

Post by onli »

Hi Garvin
I dont properly understand why. The id of the entry has its own place in the url, shouldn't that be discoverable (as the URL-Pattern is known)?

"Pfad zu den Einträgen" is set to archives. I added archives to the front of the url, so it looked like http://www.onli-blogging.de/index.php?/ ... esden.html. But that didn't solve the issue and also breaks all old link (http://www.onli-blogging.de/index.php?/ ... laert.html != http://www.onli-blogging.de/index.php?/ ... laert.html) - so that's no solution.

The archives-keyword needs another place in the url and the forwarding via .htaccess needs to be done manually?

Edit: Taking my permalink-structure into my testblog. In the index.php is the following pattern:

Code: Select all

@(([0-9]+)/[0-9a-z\.\_!;,\+\-\%]+\.html)/?@i
which is compared to the url via:

Code: Select all

preg_match(PAT_PERMALINK, $uri, $matches)
Taking for example:

Code: Select all

/index.php?/4/100-testeintrag.html
matches [0] becomes:

Code: Select all

/100-testeintrag.html
and matches[1]:

Code: Select all

100
Why 100? The regexp isn't selecting the numbers before the -, it is selecting the numbers before the /. Or it is selecting the whole link, depends on what counts as first bracket. I think something is wrong here.

Edit2: Got it. It's the wrong pattern. PAT_COMMENTSUB is the one which gets true before.

Code: Select all

@/([0-9]+)[_\-][0-9a-z\.\_!;,\+\-\%]*\.html@i
Hm, maybe i can change that...

Edit 3:
If i simply change the order of the if, execute the match against PAT_PERMALINK first, everything seems to work (line 254/255 in index.php). Is there maybe a way to make that less errorprone generally? Probably adding archives/ like it used to be didn't work because even than, preg_match with PAT_COMMENTSUB returned true.

So that's really a bug - is changing the order a proper patch?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Entry disappeared after editing

Post by garvinhicking »

Hi!

Hm, I thought we already had means in place that would catch the permalink archives pattern before commentsub takes place. Sadly I'm currently lacking the time to investigate this thoroughly - maybe you can remind me of it next week?

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/
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Entry disappeared after editing

Post by onli »

*remind* ;)
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Entry disappeared after editing

Post by onli »

Hi
I just stumbled over this bug again, http://www.onli-blogging.de/index.php?/ ... ssung.html vanished. Totally forgot my patch after the last s9y-update. Can we fix this in core?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Entry disappeared after editing

Post by Timbalu »

Hi Malte

You have GIT access haven't you?
If not, tell me what to change.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Entry disappeared after editing

Post by onli »

Code: Select all

diff -Nur Downloads/index-1.6.php Downloads/index.php
--- Downloads/index-1.6.php	2011-12-10 15:16:39.425894289 +0100
+++ Downloads/index.php	2011-12-10 13:25:57.505896370 +0100
@@ -251,8 +251,8 @@
     }
 
     echo $data;
-} else if ( (preg_match(PAT_COMMENTSUB, $uri, $matches) ||
-            preg_match(PAT_PERMALINK, $uri, $matches) ||
+} else if ( (preg_match(PAT_PERMALINK, $uri, $matches) ||
+            preg_match(PAT_COMMENTSUB, $uri, $matches) ||
             isset($serendipity['GET']['id']) ||
             isset($_GET['p']))
             && !preg_match('/autosave/', $serendipity['uriArguments'][1]) ) {
Think i have. I just didnt want to change it on my own because Garvin said he wants to look into that.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Entry disappeared after editing

Post by garvinhicking »

Hi!

Please go ahead and commit, I think this should work :)

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