@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Recommend STRICT_ALL_TABLES for every install, not just development installs

Summary:
See D8308. Enabling STRICT_ALL_TABLES prevents this entire class of error, by fataling on truncation instead of truncating. We never want truncation; it is always bad and sometimes extremely bad.

We've recommended this mode for developer installs for a long time, and some users run with it enabled, so it's very unlikely to cause any issues (I've had it enabled locally for at least 6-8 months, I think).

Test Plan:
- Disabled mode.
- Saw warning.
- Enabled mode.
- No warning.

{F117040}

Reviewers: btrahan, chad

Reviewed By: chad

CC: chad, aran, arice

Differential Revision: https://secure.phabricator.com/D8309

+30 -21
+30 -21
src/applications/config/check/PhabricatorSetupCheckMySQL.php
··· 25 25 ->setMessage($message); 26 26 } 27 27 28 - if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { 29 - $mode_string = queryfx_one($conn_raw, "SELECT @@sql_mode"); 30 - $modes = explode(',', $mode_string['@@sql_mode']); 31 - if (!in_array('STRICT_ALL_TABLES', $modes)) { 32 - $summary = pht( 33 - "MySQL is not in strict mode, but should be for Phabricator ". 34 - "development."); 28 + $mode_string = queryfx_one($conn_raw, "SELECT @@sql_mode"); 29 + $modes = explode(',', $mode_string['@@sql_mode']); 30 + if (!in_array('STRICT_ALL_TABLES', $modes)) { 31 + $summary = pht( 32 + "MySQL is not in strict mode, but using strict mode is strongly ". 33 + "encouraged."); 35 34 36 - $message = pht( 37 - "This install is in developer mode, but the global sql_mode is not ". 38 - "set to 'STRICT_ALL_TABLES'. It is recommended that you set this ". 39 - "mode while developing Phabricator. Strict mode will promote some ". 40 - "query warnings to errors, and ensure you don't miss them during ". 41 - "development. You can find more information about this mode (and ". 42 - "how to configure it) in the MySQL manual."); 35 + $message = pht( 36 + "On your MySQL instance, the global sql_mode is not set to ". 37 + "'STRICT_ALL_TABLES'. It is strongly encouraged that you enable this ". 38 + "mode when running Phabricator.\n\n". 39 + "By default, MySQL will fail silently and continue when certain ". 40 + "error conditions occur. Sometimes contuining does the wrong thing. ". 41 + "For example, inserting too much data into a column will cause ". 42 + "silent truncation (and thus data loss) instead of failing in an ". 43 + "obvious way that we can fix. These behaviors can also create ". 44 + "security risks. Enabling strict mode raises an explicit error ". 45 + "instead and prevents this entire class of problem from doing any ". 46 + "damage.\n\n". 47 + "You can find more information about this mode (and how to configure ". 48 + "it) in the MySQL manual. Usually, it is sufficient to add this to ". 49 + "your 'my.cnf' file:\n\n". 50 + "%s\n". 51 + "(Note that if you run other applications against the same database, ". 52 + "they may not work in strict mode. Be careful about enabling it in ". 53 + "these cases.)", 54 + phutil_tag('pre', array(), 'sql-mode=STRICT_ALL_TABLES')); 43 55 44 - $this->newIssue('mysql.mode') 45 - ->setName(pht('MySQL STRICT_ALL_TABLES Mode Not Set')) 46 - ->addRelatedPhabricatorConfig('phabricator.developer-mode') 47 - ->setSummary($summary) 48 - ->setMessage($message); 49 - } 56 + $this->newIssue('mysql.mode') 57 + ->setName(pht('MySQL STRICT_ALL_TABLES Mode Not Set')) 58 + ->setSummary($summary) 59 + ->setMessage($message); 50 60 } 51 - 52 61 } 53 62 54 63 }