Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#16697 closed defect (bug) (duplicate)

WordPress up to version 3.1 does not work with MySQL sql_mode = TRADITIONAL

Reported by: kupokomapa Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Database Keywords:
Focuses: Cc:


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:

  1. 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);

  1. Fix the queries which insert non valid data to table fields (the dates are just one example)

Change History (2)

#1 @hakre
10 years ago

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?

#2 @ryan
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

See #14978, #8857 and other tickets.

Note: See TracTickets for help on using tickets.