WordPress.org

Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#383 closed defect (bug) (fixed)

WordPress should check whether PHP MySQL extension is installed

Reported by: anonymousbugger Owned by: matt
Milestone: Priority: normal
Severity: minor Version:
Component: General Keywords:
Focuses: Cc:

Description

The following code is from wp-includes/wpdb.php
$this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);

If the MySQL extension for PHP is not installed (mysql_connect function is not defined), then the above line stops PHP to bail out, resulting in just a blank page with no error messages whatsoever.

You can see that behaviour yourself if you change
@mysql_connect to @nosql_connect.

Attachments (2)

0000383-check_mysql-v2.patch (602 bytes) - added by anonymousbugger 16 years ago.
0000383-check_mysql.patch (605 bytes) - added by anonymousbugger 16 years ago.

Download all attachments as: .zip

Change History (6)

#2 @anonymousbugger
17 years ago

"stops" should read "causes" in the description.

#3 @tor
17 years ago

is_callabale which only checks the specific mysql function, and has an outside chance of getting duped (if mysql wasn't installed but a user-defined function was...) should probably be switched with...

if(!extension_loaded('mysql'))

This would be quite useful since php5 doesn't load the required mysql module anymore by default since they want people to use mysqli.

#4 @duke
17 years ago

Good point, new version of the patch now uses extension_loaded

#5 @matt
17 years ago

  • fixed_in_version set to 1.3
  • Owner changed from anonymous to matt
  • Resolution changed from 10 to 20
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.