Make WordPress Core

Opened 18 years ago

Closed 2 years ago

#4116 closed defect (bug) (worksforme)

wp_texturize to defect certain links in comments and on page

Reported by: h4x3d's profile h4x3d Owned by: nazgul's profile Nazgul
Milestone: Priority: normal
Severity: normal Version: 2.2.1
Component: Formatting Keywords: needs-patch has-unit-tests wptexturize bulk-reopened close
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 18 years ago.
graphic showing the error (wp_texturize)
4116.diff (570 bytes) - added by Nazgul 18 years ago.
"h4x3d_error_&#215 (46.6 KB) - added by h4x3d 18 years ago.
shows the error (both on site and source code)
header.php (1.6 KB) - added by h4x3d 18 years ago.
header.php
4116b.diff (586 bytes) - added by Nazgul 18 years ago.
4116axed.diff (1.2 KB) - added by Nazgul 17 years ago.
miqro-4116-tests.php (1.0 KB) - added by miqrogroove 11 years ago.

Download all attachments as: .zip

Change History (56)

@h4x3d
18 years ago

graphic showing the error (wp_texturize)

@Nazgul
18 years ago

#1 @Nazgul
18 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.

#2 @Viper007Bond
18 years ago

Looks good to me.

#3 @intoxination
18 years ago

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

#4 @rob1n
18 years ago

  • Keywords commit added
  • Owner changed from anonymous to rob1n

Looks good to me, as well.

#5 follow-up: @rob1n
18 years ago

  • Keywords commit removed

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

#6 in reply to: ↑ 5 @Nazgul
18 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.

#7 @rob1n
18 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.

#8 @rob1n
18 years ago

  • Keywords commit added

Okay, tried again, works. Committing.

#9 @rob1n
18 years ago

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

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

#10 in reply to: ↑ description @h4x3d
18 years ago

thanks for all your efforts!

#11 @h4x3d
18 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

@h4x3d
18 years ago

shows the error (both on site and source code)

#12 in reply to: ↑ description @h4x3d
18 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 ×...

#13 @Nazgul
18 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.

#14 follow-up: @Nazgul
18 years ago

  • Keywords has-patch commit removed

#15 in reply to: ↑ 14 @h4x3d
18 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!

#16 @h4x3d
18 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)

#17 @rob1n
18 years ago

  • Milestone changed from 2.2 to 2.2.1

#18 @h4x3d
18 years ago

thanks rob1n

#19 follow-up: @Nazgul
18 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.

#20 @Nazgul
18 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. ;)

@h4x3d
18 years ago

header.php

#21 @h4x3d
18 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.

#22 in reply to: ↑ 19 @h4x3d
18 years ago

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

@Nazgul
18 years ago

#23 @Nazgul
18 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.

#24 @rob1n
18 years ago

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

#25 @rob1n
18 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

#26 @codein2
17 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.

#27 @foolswisdom
17 years ago

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

#28 @markjaquith
17 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?

#29 @Otto42
17 years ago

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

@Nazgul
17 years ago

#30 @Nazgul
17 years ago

+1 from me as well.

I've attached a path for it.

#31 @foolswisdom
17 years ago

  • Milestone changed from 2.2.2 to 2.2.3

#32 @f00f
17 years ago

  • Milestone changed from 2.2.3 to 2.3

#33 @Nazgul
17 years ago

  • Milestone changed from 2.3 to 2.4

#34 @mrmist
16 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.

#35 @Denis-de-Bernardy
16 years ago

  • Component changed from General to Formatting

#36 @hakre
15 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

#37 @hakre
15 years ago

Related: #4152

#38 @azaozz
15 years ago

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

#39 @norbertm
14 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.

#40 @nacin
11 years ago

  • Keywords wptexturize added

#41 @miqrogroove
11 years ago

This was mostly resolved in [14144]

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

#42 @miqrogroove
11 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed

#43 @chriscct7
9 years ago

  • Keywords wptexturize removed

#44 @miqrogroove
9 years ago

  • Keywords wptexturize added

#47 @timhibberd
6 years ago

  • Keywords bulk-reopened added

This is still a problem.

I had to use

add_filter( 'no_texturize_shortcodes', 'shortcodes_to_exempt_from_wptexturize' );

because urls like http://xyz-300x200.jpg were being converted to http://xyz-300×200.jpg

#48 @Mte90
2 years ago

Tested now with 6.2 alpha, in a post content and in a comment with http://xyz-300×200.jpg.

The HTML generated in comment is <p><a href="http://xyz-300x200.jpg">http://xyz-300&#215;200.jpg</a></p>, so just sanitize the content but not the URL.

To me this ticket can be closed.

Last edited 2 years ago by Mte90 (previous) (diff)

#49 @Mte90
2 years ago

  • Keywords close added

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


2 years ago

#51 @audrasjb
2 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

As per the last old tickets triage session, it appears thats the issue can be reproduced anymore.
Closing this as worksforme.

Feel free to reopen the ticket and to share reproduction steps if you find a way to reproduce the issue :)

Note: See TracTickets for help on using tickets.