Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-19 19:33:35

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Error 404 on article save after preview

Strange phenomenon…

Steps to reproduce:

  1. Edit lengthy article (about 4000 chars in my case)
  2. switch to preview tab
  3. switch back to text tab
  4. click “save” button
  5. experience 404 error page (as defined in page templates, txp:page_url is /textpattern/index.php)
  6. save fails constantly afterwards until one reenters article editing anew by choosing the article on the article list

Workarounds:

  • shorten article :-(
  • avoid previewing

Diag:

Version Textpattern: 4.0.2 (r1158)
last_update: 2005-11-19 21:39:19/2005-11-19 21:38:59
Schema der URLs: section_title
PHP-Version: 4.3.11
Register globals: 1
MySQL: 4.0.25-standard
Regionale Einstellungen: de_DE.UTF-8
Server: Apache
php_sapi_mode: cgi
os_version: Linux 2.4.21-32.0.1.ELsmp

Strange, huh? From a glimpse at the source it seems that the switch from “preview” to “text” tab adds a rather heavy POST variable (“store”) to the request, which exceeds 13 kB in my case. Is anybody aware of a configuration setting in PHP, Apache, wherever influencing the maximum size of POSTed HTTP-vars?

Cross-checking on another server shows that this symptom is system dependent and does not occur on a second host.

//w&

Last edited by wet (2005-12-19 19:34:46)

Offline

#2 2005-12-19 20:41:51

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: Error 404 on article save after preview

Do you have any problems uploading files or images to the same server?

Can you reproduce it with straight text (say, 5000 bytes of Lorem Ipsum)?


Alex
tstate

Offline

#3 2005-12-19 21:01:52

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: Error 404 on article save after preview

> zem wrote:

Do you have any problems uploading files or images to the same server?

None. Upload limit is at 2 MiB.

Can you reproduce it with straight text (say, 5000 bytes of Lorem Ipsum)?

No. A preview of an even longer article does not lead to that 404 condition so I was wrong when I assumed it was a matter of size. I’ve just included and partially removed various portions of the offending post into a shell of lorem ipsum text, and at some point it simply breaks, though I cannot identify the exact reason. The offending HTTP request is here if this might reveal something.

Last edited by wet (2005-12-19 21:26:48)

Offline

#4 2005-12-19 22:09:13

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Error 404 on article save after preview

It could be a server-problem. There is nothing in the backend-code that generates a 404. Maybe something at the server trips a different error-condition, but cannot find the error-document for the other error-code, and finally returns a 404.

Is this a non-Apache webserver? Or is it possible that there are some webserver-extensions installed that handle/filter Requests (maybe for spam-prevention or sth. similar)?

Offline

#5 2005-12-19 22:24:17

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: Error 404 on article save after preview

The offending HTTP request is here if this might reveal something.

Thanks, I’ll take a look. Is there any chance it’s a field other than the body, or has your testing ruled that out?

Oh, and one other question: is it definitely the Textpattern error_default template that’s displayed? You don’t have an Apache ErrorDoc configured that looks similar?

Last edited by zem (2005-12-19 22:35:42)


Alex
tstate

Offline

#6 2005-12-19 22:32:52

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: Error 404 on article save after preview

I’ve made up a test post in these successive steps:

  1. 5 kB of lorem ipsum body: Works fine.
  2. 5 kb of lorem ipsum body plus the initial paragraph of lorem ipsum as an excerpt: Works fine.
  3. that lorem ipsuim plus all of my offending article pasted past the “lorem ipsum” body: Fails.
  4. Various suspicious sequences removed (html source text formated as <pre ><code >meta http-equiv [...]</pre ></code >: Fails.
  5. Various length reductions: Fails.
  6. …gave up…

It is an Apache 1.3.34, and I must admit I’ve got no clues if and which extension may have been installed (shared hosting). The hosting provider does not boast on any unusual counterspam measures. htaccess is just off-the-shelf textpattern default.

As the error page served is the one defined in the textpattern repository (error_default), I assume that this is not an error condition detected by the web server but generated by some URL checking code in Textpattern, and maybe a final call to txp_die.

Without extensive cross-checking I think this depends on the article text somehow, but I wouldn’t believe it for myself if someone else told me so ;-) Bad moon rising….

Thanks for looking at this.

Last edited by wet (2005-12-19 22:43:00)

Offline

#7 2005-12-19 22:44:05

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: Error 404 on article save after preview

I assume that this is not an error condition detected by the web server but generated by some URL checking code in Textpattern, and maybe a final call to txp_die.

The strange part is, there’s only one call to txp_die() from the admin side, and that specifies a 503 error, not 404.


Alex
tstate

Offline

#8 2005-12-19 22:55:20

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: Error 404 on article save after preview

For your viewing pleasure
i’ve just removed upm_img_popper and upm_savenew, as I wanted the article page to be as pure as possible. Didn’t help either. Fails in Opera 8.50 and Firefox 1.5.

Last edited by wet (2005-12-20 05:44:35)

Offline

#9 2005-12-20 06:15:47

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: Error 404 on article save after preview

I don’t suppose there are other plugins that might be relevant? URL/rewrite/redirect type plugins being the most likely culprits.

This is quite puzzling. As you say, the fact that it’s a txp_die() error means it must be happening within Textpattern; yet I can’t see an opportunity for it in the core code.

Here’s an idea. Inside txp_die(), add something like this just before the die() call:

<pre><code>
echo “< pre>”;
var_dump(debug_backtrace());
echo “< / pre>”;
</code></pre>

(minus the obvious spaces.. add some HTML comments in the echo statements if you want to keep it hidden)

That’ll show a call stack, so we can see what function called txp_die().


Alex
tstate

Offline

#10 2005-12-20 06:22:54

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: Error 404 on article save after preview

Trace is here.
Dump of pretext inside textpattern(), line #419 is here.
Dump of $out inside preText() just before the line is_404 = 0; is here.

What else could I provide?

Last edited by wet (2005-12-20 06:44:14)

Offline

#11 2005-12-20 06:44:33

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: Error 404 on article save after preview

Thanks. The backtrace shows that things are obviously awry, but at the same time is strangely empty. I’m guessing PHP’s call stack is easily fooled by eval() or preg_replace_callback().

Did you create that trace by reproducing the 404 error when saving from the admin interface? If the trace is accurate, it’s loading …/public_html/index.php – which should never be the case for an admin page (unless you’ve done something weird with your paths).

My guess is there’s a 301 or 302 redirect happening before the 404 error.


Alex
tstate

Offline

#12 2005-12-20 06:55:24

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,267
Website

Re: Error 404 on article save after preview

> zem wrote:

Did you create that trace by reproducing the 404 error when saving from the admin interface?

Yes.

(unless you’ve done something weird with your paths).

I don’t think so. It doesn’t happen with other articles.

My guess is there’s a 301 or 302 redirect happening before the 404 error.

Wouldn’t that be visible in the HTTP header dump? I used HTTPLiveHeaders with FF, and it showed an immediate sequence of the POST request and the 404 response. Take a look at this vardump for out$ and the request_uri therein.

Last edited by wet (2005-12-20 07:00:23)

Offline

Board footer

Powered by FluxBB