Make WordPress Core

Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#19028 closed defect (bug) (fixed)

make_clickable fails when <a ...> contains \r characters

Reported by: josepsanzcamp's profile josepsanzcamp Owned by: nacin's profile nacin
Milestone: 3.9 Priority: normal
Severity: minor Version: 3.2.1
Component: Formatting Keywords: has-patch
Focuses: Cc:



I'm using the make_clickable php function in my project SaltOS to add the links feature to the email client and feeds reader.

I detect that when try to make clickable the urls that has the link tag and this tag contains \r characters it fails.

I fixed the problem removing all \r of the <a ...> tag but understand that can be a possible bug.

Thanks in advance.

Attachments (2)

index.php (279 bytes) - added by josepsanzcamp 12 years ago.
19028.diff (776 bytes) - added by dd32 12 years ago.

Download all attachments as: .zip

Change History (12)

#1 @dd32
12 years ago

Could you post an example of the input, the expected output, and the current output of the function? It'll make it easier to reproduce the exact case you're referring to

12 years ago

#2 @josepsanzcamp
12 years ago


I added an example of the problem. Is detected that the problem is the absence of the space between the "<a" and the "href=...": "<a\nhref=...".


12 years ago

#3 @dd32
12 years ago

  • Keywords has-patch needs-testing added

Added an attachment which simply looks for whitespace between <a and the next attribute rather than specifically a space. Works in the case outlined above, but unsure if it has any other issues?

#4 @josepsanzcamp
12 years ago

I apply the patch in the line 1386 of the formatting.php (wp v3.2.1) and runs fine. It produce the expected result. For me, the issue is fixed correctly.

Another issue related to the same use: I'm using the make_clickable in my app without wordpress. To do this, I copied the files needed (formatting.php, plugin.php and kses.php) because I want to use the original files provided by the wp project directly by maintenance reasons. I detect too that if I define a function that do the requires_once of the needed files inside the function, too I must to do globals the follow variables: $allowedposttags, $allowedtags, $allowedentitynames. You can think of a solution that don't uses global variables to allow a more easily of code recycling.

Thanks for your great job.


#5 @josepsanzcamp
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#6 @nacin
12 years ago

  • Keywords needs-unit-tests added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Tickets are only closed fixed if a change is actually made to WordPress. The patch above was only a proposal.

#7 @edwardw
12 years ago

  • Keywords dev-feedback added; needs-testing needs-unit-tests removed

#8 @SergeyBiryukov
12 years ago

  • Keywords needs-unit-tests added

#9 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from reopened to closed

In 26974:

make_clickable: When cleaning up accidental links within links, account for the tag being split by newlines.

props dd32.
fixes #19028.

#10 @nacin
10 years ago

  • Keywords dev-feedback needs-unit-tests removed
  • Milestone changed from Awaiting Review to 3.9
Note: See TracTickets for help on using tickets.