wiki.techinc.nl/tests/phpunit/includes/libs/rdbms
Tim Starling 673d496f2d Have Database::addQuotes() pass through bare integers without quoting
Quotes started being added to integers in r4984 (August 2004). Before
that, is_numeric() was used to determine whether to add quotes, so
quotes were omitted from numeric strings, which is obviously wrong.

The idea here is to use the type of the variable to hint to the database
as to whether quotes are needed. The results are somewhat inconsistent,
since some callers do not convert numeric strings obtained from user
input to integers. That makes it a more conservative change. Callers can
opt out of unquoted integers by casting them to string.

The reason for doing this is that quoting integers turns out to be not
as harmless as originally assumed. We found a case of it confusing the
MariaDB query planner, causing inappropriate indexes to be used.

I also made addQuotes() consistently return a string, instead of
returning an integer for boolean values. This was already the case for
MySQL, but it seems like a good idea everywhere.

Bug: T238378
Change-Id: I70473280f542ee5ecd79e187f580807410fbd548
2019-11-18 11:40:28 +11:00
..
connectionmanager Update tests to use PHPUnit 6 class names 2019-10-06 01:01:28 -07:00
database Have Database::addQuotes() pass through bare integers without quoting 2019-11-18 11:40:28 +11:00
resultwrapper Add ResultWrapper/FakeResultWrapper tests 2019-07-11 19:57:14 +00:00
ChronologyProtectorTest.php Revert "Separate MediaWiki unit and integration tests" 2019-06-13 23:00:08 +00:00
TransactionProfilerTest.php Revert "Separate MediaWiki unit and integration tests" 2019-06-13 23:00:08 +00:00