Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55115 new enhancement

Change deprecated wpdb::escape() method

Reported by: azouamauriac's profile azouamauriac Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Database Keywords: close 2nd-opinion
Focuses: Cc:

Description

the function wpdb::escape( string|array $data ) is depreciate as per documentation https://developer.wordpress.org/reference/classes/wpdb/escape/, but it's still using depreciated function such as wpdb::_weak_escape and itself.

I think we shouldn't use depreciated functions since charity begins at home.

Change History (5)

#1 @SergeyBiryukov
2 years ago

  • Component changed from General to Database

#2 @uzumymw
2 years ago

Function deprecated since version 3.6.0 but still in core?

Shouldn't be removed after for example two major releases (in this case in 5.6) for code cleanup?

#3 @SergeyBiryukov
2 years ago

  • Keywords close 2nd-opinion added

Hi there, welcome back to WordPress Trac! Thanks for the ticket.

WordPress generally does not remove deprecated functions, to maintain backward compatibility and avoid unnecessary breakage, but instead recommends a better way forward.

In this case, the function is no longer used in core as of [24718] / #24774, so it does not look like there's anything for core to address. As for modernizing the deprecated method itself, I don't think it's worth the effort, because it might introduce unintended side effects without a significant benefit.

#4 @SergeyBiryukov
2 years ago

  • Summary changed from Change depreciated method to Change deprecated wpdb::escape() method

#5 @uzumymw
2 years ago

Thanks for the clarification.

Nevertheless, since the release of 3.6.0 version (1 august 2013) more than 8 years have passed - enough time to implement changes to WordPress based websites.

Note: See TracTickets for help on using tickets.