Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#31951 closed defect (bug) (fixed)

WP_Press_This::_limit_string() needs to check if mb_strlen() is available

Reported by: ocean90 Owned by: azaozz
Priority: normal Milestone: 4.2
Component: Press This Version: 4.2
Severity: normal Keywords: needs-patch
Cc: Focuses:

Description

trunk/src/wp-admin/includes/class-wp-press-this.php@32106#L329​

WP_Press_This::_limit_string() uses mb_strlen() but mbstring can be disabled. Therefore we need a check if the function exists.
mb_substr() is not affected because we provide a compat version.

Related: #30633

Attachments (2)

31951.patch​ (2.5 KB ) - added by SergeyBiryukov 12 years ago.
31951.1.patch​ (938 bytes ) - added by azaozz 12 years ago.

Download all attachments as: .zip

Change History (7)

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


12 years ago

#2 @SergeyBiryukov
12 years ago

If we need a compat function, 31951.patch​ (from #29573) is similar to our current mb_substr() compat implementation.

Otherwise, just need a function_exists() check.

@azaozz
12 years ago

#3 @azaozz
12 years ago

31951.1.patch is the function_exists() check. The result is stored in a static to reduce calls to it.

I'm 50/50 on which to use. 31951.patch would be better for the long run, not sure if we should be introducing it right before RC.

#4 @azaozz
12 years ago

  • Owner set to azaozz
  • Resolution → fixed
  • Status new → closed

In 32114:

Add mb_strlen() compatibility function. Works the same way as the existing mb_substr() compatibility function.
Props SergeyBiryukov. Fixes #31951.

#5 @SergeyBiryukov
12 years ago

In 32115:

Fix a copy/paste error in a comment.

see #31951.

Note: See TracTickets for help on using tickets.