Making WordPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1297 closed defect (bug) (fixed)

Disappearing topic titles on Rosetta forums

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by:
Milestone: Priority: normal
Component: International Forums Keywords:
Cc:

Description (last modified by SergeyBiryukov)

I first encountered this issue on http://ru.forums.wordpress.org/ in February 2014, so it might be related to a dotorg commit around that time.

Some existing topic titles have suddenly disappeared, and new topics with empty titles were created almost daily, which I had to correct manually ever since then.

When this happens, the post is inaccessible on the front-end, because there is no link text: meta-1297.png.

Some examples of old topics that previously had titles:
https://ru.forums.wordpress.org/topic/Изменения-страницы-для-добавленияредактирова
https://ru.forums.wordpress.org/topic/Возможен-ли-на-wordpress-портал-по-строительству-и-недви
https://ru.forums.wordpress.org/topic/Сообщения-с-регистрационными-данными-приходят

See also a similar report from @takayukister in wp-forums list on February 9th, 2014:

Hello there. I'm a moderator of the Japanese forum (http://ja.forums.wordpress.org). We are occasionally seeing issues that topic titles disappear after opening new topics without original poster's intention.

We have heard from some users who have encountered this issue. Apparently it happens when a very long Japanese text is used for a title. I tested with one of the titles which are actually used in the problematic topics, and could reproduce the issue.

http://ja.forums.wordpress.org/topic/65611

The original title I actually input was "新着記事表示にカテゴリー名を色分けして表示する方法(複数カテゴリーに所属している場合)", but as you see, it has disappeared.

This issue started to happen about a month ago. We hadn't seen it before that. So I guess it relates to any changes to the forum system applied around that time. Were there any change?

This can be reproduced on https://wordpress.org/support/ as well:

  1. Create a new topic with "新着記事表示にカテゴリー名を色分けして表示する方法(複数カテゴリーに所属している場合)" as a title (or edit an existing one).
  2. The title will be blank.

I could not reproduce this on a clean bbPress 1.x install, so apparently it comes from a plugin.

Should be fixed with the upgrade to bbPress 2.x. This ticket is just for tracking and reference.

Attachments (3)

meta-1297.png (11.3 KB) - added by SergeyBiryukov 9 years ago.
meta-1297.recently-moderated-items.png (15.0 KB) - added by SergeyBiryukov 9 years ago.
meta-1297.php (399 bytes) - added by SergeyBiryukov 9 years ago.

Download all attachments as: .zip

Change History (18)

#2 in reply to: ↑ description @netweb
9 years ago

Replying to SergeyBiryukov:

I could not reproduce this on a clean bbPress 1.x install, so apparently it comes from a plugin.

Not sure either what the cause here is, if you edit the topic is the topic title shown?
e.g. https://ru.forums.wordpress.org/edit.php?id=5774

Should be fixed with the upgrade to bbPress 2.x. This ticket is just for tracking and reference.

As long as the bbPress 2.x importer can actually get the topic title from the database it will be, if the topic title has vanished from the database, then ¯\_(ツ)_/¯

#3 @SergeyBiryukov
9 years ago

  • Description modified (diff)

#4 follow-up: @SergeyBiryukov
9 years ago

Replying to netweb:

Not sure either what the cause here is, if you edit the topic is the topic title shown?
e.g. https://ru.forums.wordpress.org/edit.php?id=5774

Nope, it's blank there too. Does it mean those titles are no longer in the database?

I can only restore the title by copying it from the topic slug. However, slugs are often truncated (#1298), so I have to guess what the OP meant and come up with a shorter title.

As long as the bbPress 2.x importer can actually get the topic title from the database it will be, if the topic title has vanished from the database, then ¯\_(ツ)_/¯

Well, that's why I wanted to document the existing issues, to @ocean90's dismay :)

Is there way to check if the affected titles are still in the database?

#5 in reply to: ↑ 4 ; follow-up: @netweb
9 years ago

Replying to SergeyBiryukov:

Replying to netweb:

Not sure either what the cause here is, if you edit the topic is the topic title shown?
e.g. https://ru.forums.wordpress.org/edit.php?id=5774

Nope, it's blank there too. Does it mean those titles are no longer in the database?

Are the topic titles shown in /bb-admin ? e.g. https://ru.forums.wordpress.org/bb-admin/topics.php

If they are not there then I'd start to lean towards they in fact may be gone from the database :(

I can only restore the title by copying it from the topic slug. However, slugs are often truncated (#1298), so I have to guess what the OP meant and come up with a shorter title.

As long as the bbPress 2.x importer can actually get the topic title from the database it will be, if the topic title has vanished from the database, then ¯\_(ツ)_/¯

Well, that's why I wanted to document the existing issues, to @ocean90's dismay :)

Is there way to check if the affected titles are still in the database?

Have someone with access look at the database will be the only way to be certain.

Note: I'm guessing the admin/moderator links here as I'm neither of those roles on ru.forums.wordpress.org

#6 in reply to: ↑ 5 @SergeyBiryukov
9 years ago

Replying to netweb:

Are the topic titles shown in /bb-admin ? e.g. https://ru.forums.wordpress.org/bb-admin/topics.php

If they are not there then I'd start to lean towards they in fact may be gone from the database :(

Nope. I think there might be a filter on get_topic_title somewhere, but I could not find anything like that among the plugins to be migrated, and _fix-badly-utf8-trimmed-strings.php does not look like it would cause it.

Note: I'm guessing the admin/moderator links here as I'm neither of those roles on ru.forums.wordpress.org

You guessed correctly :)

#7 @SergeyBiryukov
9 years ago

  • Description modified (diff)

#8 @SergeyBiryukov
9 years ago

This can be reproduced on https://wordpress.org/support/ as well:

  1. Create a new topic with "新着記事表示にカテゴリー名を色分けして表示する方法(複数カテゴリーに所属している場合)" as a title (or edit an existing one).
  2. The title will be blank.

#9 @SergeyBiryukov
9 years ago

It's worth noting that affected topics are displayed correctly in the Recently Moderated Items meta box in Dashboard (with a broken character at the end, see the third item in meta-1297.recently-moderated-items.png), but not in the Topics list table or on the front-end.

This makes me think that the titles are still in the database, and a filter on get_topic_title somewhere might be the culprit.

Last edited 9 years ago by SergeyBiryukov (previous) (diff)

#10 @SergeyBiryukov
9 years ago

  • Description modified (diff)

#11 @SergeyBiryukov
9 years ago

@netweb pointed out that _fix_badly_utf8_trimmed_string.php is the most likely cause:

function fix_badly_utf8_trimmed_string( $string ) {
	return iconv( 'utf-8', 'utf-8//ignore', $string );
}

add_filter( 'topic_title', 'fix_badly_utf8_trimmed_string', 9 );
add_filter( 'term_name', 'fix_badly_utf8_trimmed_string', 9 );

via https://php.net/manual/en/function.iconv.php#108643:

The //ignore option doesn't work with recent versions of the iconv library. So if you're having trouble with that option, you aren't alone.

That means you can't currently use this function to filter invalid characters. Instead it silently fails and returns an empty string (or you'll get a notice but only if you have E_NOTICE enabled).

I've tested it with a broken string (Как вернуться на 4.2, как запретить автоматическое обно�), and it does return an empty string on my install (PHP 5.4.45, iconv 1.14).

mb_convert_encoding() handles this correctly:

function fix_badly_utf8_trimmed_string( $string ) {
	ini_set( 'mbstring.substitute_character', 'none' ); 
	return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
}

#12 @SergeyBiryukov
9 years ago

meta-1297.php is a test script for easier reproduction.

#13 follow-up: @ocean90
9 years ago

  • Keywords needs-testing added

Deployed this change in [dotorg11201]:

<?php
function fix_badly_utf8_trimmed_string( $string ) {
        $substitute_character = ini_get( 'mbstring.substitute_character' );

        ini_set( 'mbstring.substitute_character', 'none' );
        $string = mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
        ini_set( 'mbstring.substitute_character', $substitute_character );

        return $string;
}

#14 in reply to: ↑ 13 @SergeyBiryukov
9 years ago

  • Keywords needs-testing removed
  • Resolution set to fixed
  • Status changed from new to closed

Replying to ocean90:

Deployed this change in [dotorg11201]

Looks good now, thanks! I wonder if we could just as easily fix the other issues on #1300 :)

Last edited 9 years ago by SergeyBiryukov (previous) (diff)

#15 @netweb
9 years ago

Awesome, glad this is now sorted :)

Note: See TracTickets for help on using tickets.