Commit Graph

13 Commits

Author SHA1 Message Date
Dylan Wagstaff
8c3ba81052
FIX PHP 8.1 support in MySQLiConnector::query errors (#10570)
* FIX PHP 8.1 support in MySQLiConnector::query errors

The default error reporting mode in PHP 8.1 has changed from using
errors reported on the connection handle to throwing
mysqli_sql_exception. query() makes no allowance for this, and
functions up the call stack expect to catch
Silverstripe\ORM\Connect\DatabaseException instead - resulting in the
MySQLi exception going all the way up to halt the system.

We can use a try, catch, and finally to retain backwards compatibility,
no matter which setting (e.g. PHP version default) someone has enabled.

* Move MySQLConnector test skip call into setUp()

As review feedback; marking the test as skipped in a private function
obfuscated where the call was happening and made it harder to skimread
the tests. Moving this into a setUp function makes it obvious the check
is run before each test case, and skipped if necessary.
2023-07-07 15:56:31 +12:00
Guy Sartorelli
c4b8d9a246
FIX Add back missing SSL support for database connections (#10784) 2023-05-22 12:40:59 +12:00
Steve Boyd
a77ca74a7e FIX Ensure not passing null to mysql methods for PHP 8.1 compatibility 2022-06-29 09:34:30 +12:00
Steve Boyd
337c6e583c ENH Various fixes for PHP 8.1 compatibility 2022-04-27 09:29:40 +12:00
Steve Boyd
511b3bb060 ENH PHP 8.1 compatibility 2022-04-14 13:12:59 +12:00
William Desportes
c932d7e7fb
Fix the phpdoc blocks 2020-12-21 22:23:23 +01:00
Robbie Averill
27bd5d12e3 ENH Replace E_USER_ERROR errors with exceptions 2020-09-24 23:51:21 -07:00
Daniel Hensby
237b2d5f74
Convert array delcarations to short array syntax 2020-04-20 18:58:09 +01:00
Sam Minnee
0111b98b18 FIX: Ensure that types are preserved fetching from database
This ensures that numeric fields appear in PHP as int/float values
rather than strings, which allows the development of more type-safe PHP
code.

This doesn’t work on the legacy mysql driver and this will now throw
a notice-level error. It requires mysqlnd.
2018-11-09 10:31:19 +13:00
Robbie Averill
437e53f2fe NEW Some minor refactoring of the PDO and MySQLi connectors
Some small performance optimisations (not using callables in loops, switch strval for string
casting), Config call updates and replace call_user_func_array with direct variadic call.
Also removes some redundant else statements after returns.
2018-10-17 12:54:42 +02:00
Daniel Hensby
c0211927aa
Merge branch '3' into 4 2017-08-14 21:18:03 +01:00
Damian Mooyman
1b1e921e3d
PSR2: Whitespace-only changes 2016-11-29 12:31:16 +13:00
Sam Minnee
7a10c194bd NEW: Move code files into src/ folder.
This updates framework to be more in keeping with PHP conventions.
2016-11-01 13:37:24 +13:00