WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 3 weeks ago

#4116 reopened defect (bug)

wp_texturize to defect certain links in comments and on page

Reported by: h4x3d Owned by: Nazgul
Milestone: Future Release Priority: normal
Severity: normal Version: 2.2.1
Component: Formatting Keywords: needs-patch wptexturize has-unit-tests
Focuses: Cc:

Description

the wp_texturize() function in formatting.php (includes) of wordpress breaks links of the domain format (number)x(number).

For example, a comment left by a domain such as www.h4x3d.com, which includes the (4)x(3) in the domain name, renders to www.xn--h43d-rma.com. This breaks the link.

It does occur on the page, but also with in the page comments.
It does also occur when the text with the special combination is not a link, but plain text.

Attachments (7)

wp_texturize.gif (14.2 KB) - added by h4x3d 7 years ago.
graphic showing the error (wp_texturize)
4116.diff (570 bytes) - added by Nazgul 7 years ago.
"h4x3d_error_&#215 (46.6 KB) - added by h4x3d 7 years ago.
shows the error (both on site and source code)
header.php (1.6 KB) - added by h4x3d 7 years ago.
header.php
4116b.diff (586 bytes) - added by Nazgul 7 years ago.
4116axed.diff (1.2 KB) - added by Nazgul 7 years ago.
miqro-4116-tests.php (1.0 KB) - added by miqrogroove 3 weeks ago.

Download all attachments as: .zip

Change History (49)

h4x3d7 years ago

graphic showing the error (wp_texturize)

Nazgul7 years ago

comment:1 Nazgul7 years ago

  • Keywords has-patch added

This is caused by make_clickable being run after wp_texturize.

If you switch those around the link text still gets changed, but the link href works.

Attached patch does just that.

comment:2 Viper007Bond7 years ago

Looks good to me.

comment:3 intoxination7 years ago

Glad someone figured this out. It is one of those bugs that has been a nightmare. It was reported on #3777 also.

comment:4 rob1n7 years ago

  • Keywords commit added
  • Owner changed from anonymous to rob1n

Looks good to me, as well.

comment:5 follow-up: rob1n7 years ago

  • Keywords commit removed

I could reproduce this on a trunk install, but the patch didn't fix it.

comment:6 in reply to: ↑ 5 Nazgul7 years ago

Replying to rob1n:

I could reproduce this on a trunk install, but the patch didn't fix it.

What input did you use? I tried all the cases I could think of and got all working links with my patch.

Just curious what I missed.

comment:7 rob1n7 years ago

I put http://www.h4x3d.com/ (just text) in a comment, but it didn't turn out quite like what the description says. It was messed up, just that http://www.h4 and then the x was a multiplication sign, and the rest text.

I tried switching the priority to 9, but still nothing. I'll try again.

comment:8 rob1n7 years ago

  • Keywords commit added

Okay, tried again, works. Committing.

comment:9 rob1n7 years ago

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

(In [5236]) Run make_clickable before texturize. Props Nazgul. fixes #4116

comment:10 in reply to: ↑ description h4x3d7 years ago

thanks for all your efforts!

comment:11 h4x3d7 years ago

  • Priority changed from normal to high
  • Resolution fixed deleted
  • Severity changed from minor to normal
  • Status changed from closed to reopened
  • Version changed from 2.1.3 to 2.2

I was just trying out the 2.2er version of wordpress on my website (h4x3d.com) and found out that some instances (see attached image (50kb) or source code of http://wordpress.h4x3d.com)of 4x3 are turned into × which breaks the link to the style-sheet and so on.

I assume this is connected to the wp_texturize function. Can anyone help me?
I have set-up a test-install of wordpress 2.2 on http://wordpress.h4x3d.com

h4x3d7 years ago

shows the error (both on site and source code)

comment:12 in reply to: ↑ description h4x3d7 years ago

  • Status changed from reopened to new

(4)x(3) in the domain name renders to www.h4×3d.com. This breaks the link.
not sure which breakage I prefer, the wordpress 2.1 xn-rma break or this ×...

comment:13 Nazgul7 years ago

Try removing the , '/(\d+)x(\d+)/' and , '$1×$2' parts from the $dynamic_characters= and $dynamic_replacements= lines in the wp_texturize function.

comment:14 follow-up: Nazgul7 years ago

  • Keywords has-patch commit removed

comment:15 in reply to: ↑ 14 h4x3d7 years ago

Replying to Nazgul:
works like a charm nazgul. removed it from /wp-includes/formatting.php

is this likely to get fixed in a future release of wordpress?
thank a lot for your help already!

comment:16 h4x3d7 years ago

I put it to work on http://themes.h4x3d.com and left http://wordpress.h4x3d.com unfixed for later review (if anyone needs to check the defect)

comment:17 rob1n7 years ago

  • Milestone changed from 2.2 to 2.2.1

comment:18 h4x3d7 years ago

thanks rob1n

comment:19 follow-up: Nazgul7 years ago

Replying to h4x3d:

Replying to Nazgul:
works like a charm nazgul. removed it from /wp-includes/formatting.php

is this likely to get fixed in a future release of wordpress?
thank a lot for your help already!

I did some further testing. The code is there for a reason, it makes certain types of text look pretty, but it shouldn't be used on (part of) links. Therefore it seems theme related.

Could you attach the header.php from your theme here, so I can do some further testing?

I'm also lowering the priority, because you have a working workaround and not a lot of people are affected by this.

comment:20 Nazgul7 years ago

  • Priority changed from high to normal

Duh... I actually have to change the priority. Just typing about it doesn't make it happen. ;)

h4x3d7 years ago

header.php

comment:21 h4x3d7 years ago

sure thing nazgul,
but I think it is theme UNrelated, as it appears to happen even with the default wordpress theme. the link to the stylesheet is broken due to the 4x3 in the domain name and the filter changing it from the actual 4x3 into some fancy ascii multiply-sign which breaks it.

comment:22 in reply to: ↑ 19 h4x3d7 years ago

I uploaded the files as you wanted and added some more description in my posts above, how can I help additionally?

Nazgul7 years ago

comment:23 Nazgul7 years ago

  • Keywords has-patch added
  • Owner changed from rob1n to Nazgul
  • Status changed from new to assigned

It took me a lot longer to track this bug down than I'd thought.

There is a bug which was introduced in changeset [4983], which causes all thing passed to bloginfo to be wptexturized, instead of just the non-url ones.

I've attached a patch which fixes this.

comment:24 rob1n7 years ago

Wow. Four characters. I'm amazed :).

comment:25 rob1n7 years ago

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

(In [5526]) Fix bloginfo() filtering when it comes to links. Props Nazgul. fixes #4116

comment:26 codein27 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I think it make more sense if the pattern look something like this: /(\d+)x(\d+[\w])/ in place of /(\d+)x(\d+)/

because a 23x23 is math but a url like http://www.youtube.com/watch?v=irWR7F0x2uU isn't.

maybe there are better solution but this pattern broke some video/youtube plugins because the url looks like ..?v=irWR7F0×2uU wich a flashplayer didn't unterstand.

comment:27 foolswisdom7 years ago

  • Milestone changed from 2.2.1 to 2.2.2
  • Version changed from 2.2 to 2.2.1

comment:28 markjaquith7 years ago

You know what? We've burnt a lot of cycles on this over the years. Poor h4x3d is always getting screwed by this. Why don't we just axe it adn leave mathematical forumas up to plugins?

comment:29 Otto427 years ago

+1 to that. I don't see that converting number x number into number × number is particularly useful anyway.

Nazgul7 years ago

comment:30 Nazgul7 years ago

+1 from me as well.

I've attached a path for it.

comment:31 foolswisdom7 years ago

  • Milestone changed from 2.2.2 to 2.2.3

comment:32 f00f7 years ago

  • Milestone changed from 2.2.3 to 2.3

comment:33 Nazgul7 years ago

  • Milestone changed from 2.3 to 2.4

comment:34 mrmist5 years ago

  • Keywords needs-patch added; has-patch removed

See also #4539, #3810. It'd be nice if all the wp_texturizes fixes could be lumped together and sorted. Pattern-matching is not for me though.

comment:35 Denis-de-Bernardy5 years ago

  • Component changed from General to Formatting

comment:36 hakre5 years ago

  • Keywords needs-unit-tests added

Another long-player in the formatting bug league, +1 for getting a
definition, unit-tests and merging with related ones.

Versus: #3833

comment:37 hakre5 years ago

Related: #4152

comment:38 azaozz4 years ago

  • Keywords wp_texturize removed
  • Milestone changed from 2.9 to Future Release

comment:39 norbertm3 years ago

  • Cc norbert@… added

Both math and URLs containing (number)x(number) will be fixed by #4539. Submitting unit tests there together with a bunch of other tests for the same ticket.

comment:40 nacin3 months ago

  • Keywords wptexturize added

comment:41 miqrogroove6 weeks ago

This was mostly resolved in [14144]

It would still be a problem where a domain name begins or ends with the 9x9 phrase.

miqrogroove3 weeks ago

comment:42 miqrogroove3 weeks ago

  • Keywords has-unit-tests added; needs-unit-tests removed
Note: See TracTickets for help on using tickets.