WP-Filebase icon indicating copy to clipboard operation
WP-Filebase copied to clipboard

Deprecated mysql function

Open foamrider opened this issue 9 years ago • 1 comments

Hi

Tried to upgrade to PHP7.0 on my WP site with WP-Filebase installed. Generated error caused by the deprecated mysql_close function in:

https://github.com/f4bsch/WP-Filebase/blob/8bb80a9a147262231d007810be43f1c03f2ce45a/classes/Download.php#L467

Also line 469.

Should be replaced with mysqli og pdo

foamrider avatar Dec 07 '15 21:12 foamrider

Hi, wpdb has no close, I created a ticket for that: https://core.trac.wordpress.org/ticket/34903

Wrapping it into a function_exists check is a workaround (leaving the db connection open):

        if(function_exists('mysql_close')) {
            global $wpdb;
            if(!empty($wpdb->dbh) && is_resource($wpdb->dbh))
                    @mysql_close($wpdb->dbh);
            else
                    @mysql_close();
        }

fl4p avatar Dec 08 '15 00:12 fl4p