WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 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
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Press This Keywords: needs-patch
Focuses: Cc:
PR Number:

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 5 years ago.
31951.1.patch (938 bytes) - added by azaozz 5 years ago.

Download all attachments as: .zip

Change History (7)

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


5 years ago

#2 @SergeyBiryukov
5 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
5 years ago

#3 @azaozz
5 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
5 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to 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
5 years ago

In 32115:

Fix a copy/paste error in a comment.

see #31951.

Note: See TracTickets for help on using tickets.