Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#5424 closed defect (bug) (invalid)

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

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

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 19 years ago.

Download all attachments as: .zip

Change History (9)

#1 @ryan
19 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.

#2 @DD32
19 years ago

Now why didnt i notice that? :)

#3 @lloydbudd
19 years ago

  • Milestone 2.4 → 2.6

#5 @matt
19 years ago

  • Resolution → invalid
  • Status new → closed

#6 @DD32
19 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

#7 @darkdragon
19 years ago

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

#8 @Nazgul
19 years ago

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