Opened 15 years ago
Closed 15 years ago
#16697 closed defect (bug) (duplicate)
WordPress up to version 3.1 does not work with MySQL sql_mode = TRADITIONAL
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.1 |
| Component: | Database | Keywords: | |
| Focuses: | Cc: |
Description
Being bitten up several times by this problem. If you use MariaDB as a MySQL server you would notice that their default settings for sql_mode (http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html) is set to NO_ENGINE_SUBSTITUTION,TRADITIONAL
This does not work with many of the SQL queries in WordPress, expecially the ones that insert null values for date columns. So two choices here:
- is to make the sql_mode less strict byt choosing the optimal value for wordpress (I put this in the construct() method of WP_DB)
mysql_query($this->prepare("SET sql_mode = ;"), $this->dbh);
- Fix the queries which insert non valid data to table fields (the dates are just one example)
Change History (2)
Note: See
TracTickets for help on using
tickets.
Thanks for reporting the issue. It should be possible for some "hotfix" to add your own db-class that is extending from wp-db so to overwrite the wp-db default constructor.
Anyway, can you provide a patch for your modification for other users who have a similar problem?