WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27157 closed defect (bug) (invalid)

Theme template issue in handling form submission with a specific name in input type text.

Reported by: abhineet Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.1
Component: Themes Keywords:
Focuses: template Cc:
PR Number:

Description (last modified by SergeyBiryukov)

Hi,
I just noticed that there's a bug in wordpress template handling.
If we create a page & selected custom template in which a form submit is written & uses 'name' as name in input field then it forces wordpress to redirect to 404 page instead of template page itself.

<input class="username" type="text" name="name">

Step to create this bug:
1) Create a template & write form submit code in it.

 <form name="myForm" method="post" action="<?php echo $_SERVER["REQUEST_URI"] ?>">
	<p>Your Email* :</p>
	<input class="email-text-box" type="text" name="email">
	<p>Your Name* :</p>
	<input class="name-text-box" type="text" name="name"> <!-- Here name='name' forces wordpress to redirect to 404 page-->
	<input name="send" type="submit" value="Send">
</form>

2) Create a page & set it to this custom template.
3) Goto this page & Submit your value & it'll redirect you to 404 page.
4) Change

<input class="name-text-box" type="text" name="name">

to something else let's say

<input class="name-text-box" type="text" name="testusername">

Now it'll work properly.

I'm not sure about reserved character, but i googled it & didn't find anything.

Change History (1)

#1 @SergeyBiryukov
6 years ago

  • Description modified (diff)
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

name query var is a reserved term, as it's used internally by WordPress:
http://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms

Note: See TracTickets for help on using tickets.