Make WordPress Core

#58724 closed defect (bug) (duplicate)

Remove deprecated parameter test in convert_chars()

Reported by: cybr's profile Cybr Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: performance Cc:


Similar: #58723.

In convert_chars(), the last parameter is unused and is checked if it's not empty. If is is, only a deprecation warning is shown for a WordPress version of the distant past.

I suggest removing the parameter altogether.

If we _must_ keep the deprecation warning, at least use if ( $deprecated ) instead of if ( ! empty( $deprecated ) ) for the former is about 2.7x faster while achieving the same.

Here's the test proving ! empty() is slower than a plain boolean check:

Change History (3)

#1 @audrasjb
13 months ago

Hello and thanks for the ticket!

I suspect there is a lot of other occurrences of this in Core, isn't it? In this case, maybe we can use #58723 as an umbrella ticket to address this general issue and send all the patches/PRs.

#2 @Cybr
13 months ago


Yes. After realizing there was a pattern, I found a total of 38 instances (including this one) in Trunk using regex:
function.*?deprecated[0-9]{0,2} = .{1,10} \)

I'm OK with continuing on the other ticket.

Last edited 13 months ago by Cybr (previous) (diff)

#3 @joemcgill
11 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I'm marking this one as a duplicate in favor of #58723, given @audrasjb's suggestion that this effort be consolidated to a single ticket.

Note: See TracTickets for help on using tickets.