Opened 21 years ago
Closed 20 years ago
#1978 closed defect (bug) (fixed)
Quotes in post title make it into the title for comments_popup_link()
| Reported by: | Viper007Bond | Owned by: | markjaquith |
|---|---|---|---|
| Priority: | high | Milestone: | 2.1 |
| Component: | Administration | Version: | 2.0 |
| Severity: | major | Keywords: | bg|has-patch bg|commit |
| Cc: | Focuses: |
Description
If you have a post with quotes in it, they make it into the title for the comments_popup_link() link. This makes invalid code.
Example:
Post title = Announcing "Alphabetical Plugins"
Then this code:
comments_popup_link('Comments Off', '1 Comment »', '% Comments »');
produces:
<a href="http://www.viper007bond.com/archives/2005/11/27/announcing-alphabetical-plugins/#respond" title="Comment on Announcing "Alphabetical Plugins"">Comments Off</a>
Solution: htmlspecialchars() or wp_texturize() needs to be run on the post title before it's used.
Attachments (2)
Change History (13)
#1
@
21 years ago
Since you didn't attach the diff file yourself, I just did it for ya. Props to you for solution.
#2
@
21 years ago
Much appreciated. :) I don't have any SVN software or anything to make a diff file with, so... :/
#4
@
21 years ago
- Keywords bg|has-patch added
Not sure if wp_texturize() or htmlspecialchars() is the preferred thing for this BTW.
#6
@
21 years ago
- Keywords bg|commit added
- Milestone → 2.1
- Owner changed from to
- Status new → assigned
#8
@
21 years ago
Yeah, that's best.
When I wrote this over 3 months ago, I wasn't aware of how to create patches and the function wp_specialchars(). I was such a noob. :D
#9
@
21 years ago
wp_specialchars needs to be called with a true second argument to actually replace quotes. Like this wp_specialchars($post->post_title, 1).
If this change is done to the patch, it works for me.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
wraps wptexturize() around $post_title