WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5424 closed defect (bug) (invalid)

wpdb: use function_exists() instead of slower version_compare()

Reported by: DD32 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Optimization Keywords: has-patch
Focuses: Cc:

Description

Wpdb's escaping code currently compares the PHP version to determine if a function will be available or not.

function_exists('mysql_real_escape_string');

is about twice as fast as the current code(on testing of 1,000 iterations):

version_compare( phpversion(), '4.3.0' );

Attachments (1)

5424.wpdb-version_compare.diff (569 bytes) - added by DD32 6 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 ryan6 years ago

That code isn't even be running since we return on the line before. But, yes, function_exists is better for such things.

comment:2 DD326 years ago

Now why didnt i notice that? :)

comment:3 lloydbudd6 years ago

  • Milestone changed from 2.4 to 2.6

comment:5 matt6 years ago

  • Resolution set to invalid
  • Status changed from new to closed

comment:6 DD326 years ago

While this has been set to Invalid, Please keep it in mind in relation to #5455 which is suggesting to use real_escape again

comment:7 darkdragon6 years ago

I don't think this should be set to invalid.

comment:8 Nazgul6 years ago

  • Milestone 2.6 deleted
Note: See TracTickets for help on using tickets.