Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Undefined Index and 302 Found for comment submission
I’ve been dealing with the 302 Found problem for the last 3 hours, but think I’m getting close—the comment is actually being recorded. However, when the user previews their comment, they get the following error message:
tag_error <txp:comments_form preview=“1” /> -> Notice: Undefined index: nonce on line 243
tag_error <txp:comments_form preview=“1” /> -> Notice: Undefined index: secret on line 244
Looking through the diagnostics, I found the following:
<pre>
[SQL (0.000331): insert into `txp_discuss_nonce` set issue_time=now(), nonce=‘17ed939b5a011a4f92db1856a927025e’, secret=‘3ec466b165c6f87dfb8a633ac458b7c6’]
[SQL (0.000383): select nonce, secret from `txp_discuss_nonce` where nonce in (‘backpage/thevoice/index.php?id=3’)]
[SQL (0.000167): select Form from `txp_form` where `name` = ‘comment_form’ limit 1]
</pre>
When the comment is submitted, the user gets a 302 found message plus a 500 internal error. From my comments_display form, which is the same one I use on my personal site (different server):
<pre>
<fieldset id="comment-form">
<legend>Comment</legend>
<txp:if_comments_error>
<txp:comments_error wraptag="ul" break="li" />
</txp:if_comments_error>
<label for="name">Name</label>
<txp:comment_name_input />
<br />
<label for="email">Email address (protected)</label> <txp:comment_email_input /> <br />
<label for="web">http://</label> <txp:comment_web_input /> <br /><txp:comment_remember />
<label for="message">Message</label> <txp:comment_message_input /> <br />
<txp:comment_preview /><txp:comment_submit />
</fieldset>
</pre>
The rest of the comment forms can be found here.
Here are the diagnostics:
<pre>
Textpattern version: 4.0.3 (r1188)
Last Update: 2006-08-07 07:09:29/2006-08-07 07:09:21
Document root: (client site)
$path_to_site: -
Textpattern path: -
Permanent link mode: messy
Temp folder: -
Site URL: -
PHP version: 4.4.2
Register globals: 1
Server Local Time: 2006-08-07 02:12:39
MySQL: 4.0.26-log
Locale: en_GB.ISO_8859-1
Server: Apache/1.3.34 (Unix)
PHP Server API: cgi-fcgi
Server OS: FreeBSD 4.11-RELEASE-p19
.htaccess file contents:
————————————
DirectoryIndex index.php index.html
Options +FollowSymLinks
RewriteBase /thevoice/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) – [PT,L]
RewriteRule ^(.*) index.php
</IfModule>
#php_value register_globals 0
————————————
Charset (default/config): latin1/latin1
character_set: latin1
character_sets: latin1 dec8 dos german1 hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew win1251 estonia hungarian koi8_ukr win1251ukr greek win1250 croat cp1257 latin5
18 Tables: OK
PHP extensions: xml, tokenizer/0.1, standard/4.4.2, session, posix, overload, mysql, ctype, zlib/1.1, pcre, openssl, eAccelerator/0.9.3, ftp, gd, gettext, mcrypt, mhash, sockets
/include/txp_category.php: r1154 (dffd7979531373149c74e3eedfbb50e2)
/include/txp_plugin.php: r1167 (c2c7d7fc1e4918c79cd3658c62e4fbda)
/include/txp_auth.php: r1166 (3e2eaca7b151e14561125ab68e722203)
/include/txp_form.php: r947 (c0e4393328985742bd81cda61d10d5ed)
/include/txp_section.php: r1154 (d85c1ce405fccd9dac364c8ef4eb72eb)
/include/txp_tag.php: r1134 (3e2dfbd6fdccf0693c147ba22a9705e7)
/include/txp_list.php: r1042 (e85d2de1c63b41f0e5bdcf268e3c487b)
/include/txp_page.php: r876 (e22dc37b465b87757722732a225b25f3)
/include/txp_discuss.php: r1170 (1e56e08cc95c255783410076db12529f)
/include/txp_prefs.php: r1170 (c806be1b1f238e75a5ff6b7cf8432d17)
/include/txp_log.php: r906 (68c4f32b70ce41a349f197b6bba6c200)
/include/txp_preview.php: r628 (a16f84b6610fc66db0bce51e25b7af34)
/include/txp_image.php: r1168 (e8ec79ff9b3a21c356ee23da7973b1f0)
/include/txp_article.php: r1170 (88689d7469d16c13d51bd4adff03ebd7)
/include/txp_css.php: r922 (0c596d9968052b89581d1ca65a77c5de)
/include/txp_admin.php: r1074 (7e87ff0e29101593fb170b1a2de9fd59)
/include/txp_link.php: r1154 (7c0c55ff6580793dff0626f169e64ad6)
/include/txp_diag.php: r1154 (5d66b90f7e7720dd0e3526ca1b24cf89)
/lib/admin_config.php: r877 (9aea12193cc76eea1964eb0383ec6513)
/lib/txplib_misc.php: r1170 (7000a1b27aa40c90978211e6cff358ec)
/lib/taglib.php: r628 (493878f922262157601c26a999a1c478)
/lib/txplib_head.php: r1183 (fb85b66b4e379476935233f844844bef)
/lib/classTextile.php: r1141 (b066c2bfa94a26ae3d70b245dcf81369)
/lib/txplib_html.php: r1166 (bd11de6e6daa3391eab75a46db55ae36)
/lib/txplib_db.php: r1170 (5a2c3a1e328cd343a067cbb8fd25cd79)
/lib/IXRClass.php: r765 (2efb0fb05b55c634072b0bae9af38bdd)
/lib/txplib_forms.php: r950 (74da2c67abe4786c353ea416c13656eb)
/publish/taghandlers.php: r1188 (4e8eaeb0543d8fde09d6e423af4253b9)
/publish/atom.php: r1117 (14c1aa23c708898d7723b3d6b9c89050)
/publish/log.php: r864 (c3d16d3dfe375819a19fcd62398e4b86)
/publish/comment.php: r1187 (d55dde574418d2eaf6a394d703056d9a)
/publish/search.php: r884 (80f942f1dc301857c2fa9dcb16aa1246)
/publish/rss.php: r1099 (ce0d82b9435d8f1de01c8e2b6c585f93)
/publish.php: r1186 (d5c20bf2298e87969575f9e622bf2797)
/index.php: r1172 (52f753ebb51c1f7d5312485d9dbad7e4)
/css.php: r944 (df1c754417bdfb4e97a2c83ae5b454ee)
</pre>
Preferences:
- Moderate comments? No
- On by default? Yes
- Present comments as a numbered list? No
- Mail comments to author? Yes
- Disallow user images? No
- Automatically append comments to articles? No
You can test it over here. I’ve tried everything in this thread and the other one, but nothing has helped. The latest svn version made things worse by submitting a preview each time (like a loop), instead of actually submitting the comment.
Thanks,
JM
Last edited by deldindesign (2006-08-07 09:33:27)
Offline
Re: Undefined Index and 302 Found for comment submission
Also, I removed the .htaccess, but that didn’t affect anything. The problem occurs with both messy and clean urls.
Offline
Re: Undefined Index and 302 Found for comment submission
The tag_error at the beginning is actually a bug that can rarely appear, which I will chek in a fix for shortly.
The 302 issue… I think it has to do with the fact you are using apache+fcgi. Apache decides that it won’t send the HTTP-Headers (namely Location:) to the client, and tried to handle it itself. I will try a workaround for the next release, but I can’t promise it will work.
Please try the following and tell me if it works for you:
Open textpattern/publish/comment.php and find:
txp_status_header('302 Found');
Replace it with these two lines:
$backpage = preg_replace("#(https?://[^/]+)/.*$#","$1",hu).$backpage;
txp_status_header('302 Found');
Please tell me when you made the change, so I can check your site for whether it has an effect.
Thanks.
Offline
Re: Undefined Index and 302 Found for comment submission
Thanks,
I just changed it (4:45AM MST), but it didn’t seem to improve the problem. Here’s the the code block ± a few lines:
<code>
$backpage = substr($backpage, 0, $prefs[‘max_url_len’]);
$backpage = preg_replace(“/[\x0a\x0d#].*$/s”,’‘,$backpage);
$backpage .= ((strstr($backpage,’?’)) ? ‘&’ : ‘?’) . ‘commented=’.(($visible==VISIBLE) ? ‘1’ : ‘0’);
$backpage = preg_replace(“#(https?://[^/]+)/.*$#”,”$1”,hu).$backpage;
txp_status_header(‘302 Found’);
$host = preg_replace(“/(?<=[a-z])\/.*$/i”,’‘,hu);
$backpage = $host.$backpage;
</code>
Offline
Re: Undefined Index and 302 Found for comment submission
Yep, code is correct.
Unfortunately I suspect, this is an apache+fcgi bug.
AFAIK we are doing everything by the book. Sending a 302 header and the Location header with a full URI. Why apache decides it wants to show you the error-document for 302 I cannot tell. I know it works with apache+mod_php and apache+cgi, and lighttpd+fcgi.
You could try replacing 302 found with 301 Moved Permanently – it’s the wrong semantics, but it does basically the same job. Does that make a difference?
Otherwise I am out of suggestions for now.
Offline
Re: Undefined Index and 302 Found for comment submission
Nope, I still get the “Found” message. Thanks though.
Offline
#7 2006-08-07 22:55:42
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Undefined Index and 302 Found for comment submission
Try updating to the current 4.0 development version.
Alex
Offline
Re: Undefined Index and 302 Found for comment submission
You mean this one? I already did, but it made things worse by not posting/receiving comments. I’ll try again though.
Offline