Ticket #4116 (reopened defect)

Opened 2 years ago

Last modified 1 year ago

wp_texturize to defect certain links in comments and on page

Reported by: h4x3d Assigned to: Nazgul
Priority: normal Milestone: 2.9
Component: General Version: 2.2.1
Severity: normal Keywords: wp_texturize has-patch
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

wp_texturize.gif (14.2 kB) - added by h4x3d on 04/09/07 13:29:58.
graphic showing the error (wp_texturize)
4116.diff (0.6 kB) - added by Nazgul on 04/09/07 14:02:01.
"h4x3d_error_&#215 (46.6 kB) - added by h4x3d on 05/17/07 20:21:30.
shows the error (both on site and source code)
header.php (1.6 kB) - added by h4x3d on 05/19/07 10:07:22.
header.php
4116b.diff (0.6 kB) - added by Nazgul on 05/23/07 06:59:21.
4116axed.diff (1.2 kB) - added by Nazgul on 08/03/07 09:13:09.

Change History

04/09/07 13:29:58 changed by h4x3d

  • attachment wp_texturize.gif added.

graphic showing the error (wp_texturize)

04/09/07 14:02:01 changed by Nazgul

  • attachment 4116.diff added.

04/09/07 14:04:42 changed by Nazgul

  • keywords changed from wp_texturize to wp_texturize has-patch.

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.

04/09/07 14:23:11 changed by Viper007Bond

Looks good to me.

04/09/07 14:29:14 changed by intoxination

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

04/09/07 16:12:51 changed by rob1n

  • keywords changed from wp_texturize has-patch to wp_texturize has-patch commit.
  • owner changed from anonymous to rob1n.

Looks good to me, as well.

(follow-up: ↓ 6 ) 04/10/07 07:21:42 changed by rob1n

  • keywords changed from wp_texturize has-patch commit to wp_texturize has-patch.

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

(in reply to: ↑ 5 ) 04/10/07 09:17:06 changed by Nazgul

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.

04/10/07 23:17:53 changed by rob1n

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.

04/10/07 23:20:23 changed by rob1n

  • keywords changed from wp_texturize has-patch to wp_texturize has-patch commit.

Okay, tried again, works. Committing.

04/10/07 23:21:02 changed by rob1n

  • status changed from new to closed.
  • resolution set to fixed.

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

(in reply to: ↑ description ) 04/11/07 05:58:57 changed by h4x3d

thanks for all your efforts!

05/17/07 20:20:55 changed by h4x3d

  • priority changed from normal to high.
  • status changed from closed to reopened.
  • version changed from 2.1.3 to 2.2.
  • resolution deleted.
  • severity changed from minor to normal.

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

05/17/07 20:21:30 changed by h4x3d

  • attachment "h4x3d_error_&#215 added.

shows the error (both on site and source code)

(in reply to: ↑ description ) 05/17/07 20:27:18 changed by h4x3d

  • 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 ×...

05/17/07 22:08:16 changed by Nazgul

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

(follow-up: ↓ 15 ) 05/17/07 22:08:30 changed by Nazgul

  • keywords changed from wp_texturize has-patch commit to wp_texturize.

(in reply to: ↑ 14 ) 05/18/07 04:52:06 changed by 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!

05/18/07 04:53:27 changed by h4x3d

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)

05/18/07 14:22:51 changed by rob1n

  • milestone changed from 2.2 to 2.2.1.

05/18/07 17:24:04 changed by h4x3d

thanks rob1n

(follow-up: ↓ 22 ) 05/18/07 19:01:32 changed by Nazgul

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.

05/18/07 19:02:59 changed by Nazgul

  • priority changed from high to normal.

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

05/19/07 10:07:22 changed by h4x3d

  • attachment header.php added.

header.php

05/19/07 10:08:48 changed by h4x3d

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.

(in reply to: ↑ 19 ) 05/22/07 23:16:56 changed by h4x3d

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

05/23/07 06:59:21 changed by Nazgul

  • attachment 4116b.diff added.

05/23/07 07:03:50 changed by Nazgul

  • keywords changed from wp_texturize to wp_texturize has-patch.
  • 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.

05/23/07 14:51:25 changed by rob1n

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

05/23/07 14:58:33 changed by rob1n

  • status changed from assigned to closed.
  • resolution set to fixed.

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

08/01/07 22:30:27 changed by codein2

  • status changed from closed to reopened.
  • resolution deleted.

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.

08/01/07 22:46:50 changed by foolswisdom

  • version changed from 2.2 to 2.2.1.
  • milestone changed from 2.2.1 to 2.2.2.

08/02/07 15:04:56 changed by markjaquith

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?

08/02/07 17:53:28 changed by Otto42

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

08/03/07 09:13:09 changed by Nazgul

  • attachment 4116axed.diff added.

08/03/07 09:16:55 changed by Nazgul

+1 from me as well.

I've attached a path for it.

08/09/07 19:09:30 changed by foolswisdom

  • milestone changed from 2.2.2 to 2.2.3.

08/29/07 18:01:06 changed by f00f

  • milestone changed from 2.2.3 to 2.3.

09/19/07 21:16:23 changed by Nazgul

  • milestone changed from 2.3 to 2.4.