Ticket #4116 (reopened defect (bug))

Opened 5 years ago

Last modified 15 months ago

wp_texturize to defect certain links in comments and on page

Reported by: h4x3d Owned by: Nazgul
Priority: normal Milestone: Future Release
Component: Formatting Version: 2.2.1
Severity: normal Keywords: needs-patch needs-unit-tests
Cc: norbert@…

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 Download (14.2 KB) - added by h4x3d 5 years ago.
graphic showing the error (wp_texturize)
4116.diff Download (570 bytes) - added by Nazgul 5 years ago.
"h4x3d_error_&#215 Download (46.6 KB) - added by h4x3d 5 years ago.
shows the error (both on site and source code)
header.php Download (1.6 KB) - added by h4x3d 5 years ago.
header.php
4116b.diff Download (586 bytes) - added by Nazgul 5 years ago.
4116axed.diff Download (1.2 KB) - added by Nazgul 5 years ago.

Change History

h4x3d5 years ago

graphic showing the error (wp_texturize)

Nazgul5 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.

Looks good to me.

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

  • Keywords commit added
  • Owner changed from anonymous to rob1n

Looks good to me, as well.

comment:5 follow-up: ↓ 6   rob1n5 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   Nazgul5 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.

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.

  • Keywords commit added

Okay, tried again, works. Committing.

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

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

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

thanks for all your efforts!

  • Priority changed from normal to high
  • Status changed from closed to reopened
  • Version changed from 2.1.3 to 2.2
  • Resolution fixed 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

h4x3d5 years ago

shows the error (both on site and source code)

comment:12 in reply to: ↑ description   h4x3d5 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 ×...

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: ↓ 15   Nazgul5 years ago

  • Keywords has-patch commit removed

comment:15 in reply to: ↑ 14   h4x3d5 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!

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)

  • Milestone changed from 2.2 to 2.2.1

thanks rob1n

comment:19 follow-up: ↓ 22   Nazgul5 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.

  • Priority changed from high to normal

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

h4x3d5 years ago

header.php

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   h4x3d5 years ago

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

Nazgul5 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.

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

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

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

  • Status changed from closed to reopened
  • Resolution fixed 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.

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

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?

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

Nazgul5 years ago

+1 from me as well.

I've attached a path for it.

  • Milestone changed from 2.2.2 to 2.2.3
  • Milestone changed from 2.2.3 to 2.3
  • Milestone changed from 2.3 to 2.4
  • 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.

  • Component changed from General to Formatting
  • 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

Related: #4152

  • Keywords wp_texturize removed
  • Milestone changed from 2.9 to Future Release
  • 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.

Note: See TracTickets for help on using tickets.