#9308 closed defect (bug) (invalid)
Plugins easily break wp-db.php - one line patch fixes the problem
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.7.1 |
Component: | General | Keywords: | wp-db, has-patch, needs-testing |
Focuses: | Cc: |
Description
Plugins that use the mysql_select_db() function without a link identifier can break wp-db.php as wp-db.php assumes that the table will not change during the running of the script.
The simple fix is to reselect the WP table using mysql_select_db(DB_NAME) before running @mysql_query on line 608 of wp-db.php
Change History (2)
#1
@
16 years ago
- Milestone 2.7.2 deleted
- Resolution set to invalid
- Status changed from new to closed
#2
@
16 years ago
As an aside, if you used PDO, then each instance is self contained, meaning, you can have one instance connecting to one Database and another instance connecting to another with no interference between the two.
You can achieve this using the mysql, using various hacks which are not fully tested (in theory shit that should work, tends not to). I'm almost certain that if you used the OO library of mysqli that you can also achieve the same effect.
The point is, is that WordPress expects for its environment to be immutable and it is not a bug to expect for it to stay this way. If a plugin wants WordPress to function correctly, then they need to be sure the environment stays the way WordPress wants it.
The solution here is for the badly coded plugin to be fixed.
Reselecting the database before every query is quite possibly a very expensive task, Its basically an extra query, with blogs varying from 10 to 100 queries per page load..