1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

54 Commits

Author SHA1 Message Date
Cameron
55980a29a8 Generated PHPDoc for all classes in e107_handlers where one was missing. toNumber() updated to always return int or float. 2022-04-04 10:54:24 -07:00
Cameron
0d8f3e9086 PHPDoc fixes and code optimization. 2021-12-03 14:58:33 -08:00
Nick Liu
20882920a0
Fix all PHP 8.1 test failures
* `strftime()` has been replaced with a polyfill based on `DateTime`.
* Explicit type casts/assertions added where required by PHP 8.1
* `filter_var(…, FILTER_SANITIZE_STRING)` replaced with `strip_tags()`
  or HTML entity encoding of quotation marks, depending on a guess of
  what the intended "sanitization" was
* `http_build_query()` usage type mismatches fixed
* Removed usages of the `FILE_TEXT` constant
* To avoid breaking PHP 5.6 compatibility (function return types),
  `e_session_db` no longer implements `SessionHandlerInterface`.
  Instead, the alternative non-OOP invocation of
  `session_set_save_handler()` is used instead to apply the session
  handler.
* The shim for `strptime()` still calls the native function if available
  but now suppresses the deprecation warning.

* `e_db_pdo` explicitly asks for `PDO::ATTR_STRINGIFY_FETCHES` to
  maintain consistent behavior with past versions of PHP.
* `e_db_mysql` explicitly sets `mysqli_report(MYSQLI_REPORT_OFF)` to
  maintain consistent behavior with past versions of PHP.

* Removed pointless random number generator seed from `banner` plugin
* Workaround for `COUNT(*)` SQL query in
  `validatorClass::dbValidateArray()` without a proper API for avoiding
  SQL injection
2021-09-04 15:06:19 +02:00
Cameron
06b86ee380 Avoid a PHP8 error when update() fails. 2021-03-04 16:12:01 -08:00
Cameron
0abefed880 Small fixes. 2021-02-08 18:23:36 -08:00
Cameron
11de1fc0f4 Memory optimization and more speed logging. 2021-01-24 17:16:49 -08:00
Cameron
522d71d243 Reduced some memory usage. 2021-01-24 17:00:02 -08:00
Cameron
402d1f4126 Closes #1801 Code cleanup. Deprecated method errors added. 2020-12-22 14:48:28 -08:00
Cameron
601df26d51 Code optimization for speed and reduced memory usage. 2020-12-20 11:50:10 -08:00
Cameron
0e90d4aa66 Code optimization and cleaning 2020-12-17 13:13:29 -08:00
Cameron
072c1b3a90 Fixes #4268 - missing field in table definition. Tests added. 2020-11-29 14:05:14 -08:00
Nick Liu
f655847997
e_db_pdo: DSN consistency (fixes backup function)
e_db_pdo::backup() now supports MySQL servers with custom ports

Fixes: #4225
2020-08-04 09:28:48 -05:00
Nick Liu
339765bf0e
e_db_pdo: Throw exception instead of fatal erroring on connect fail
Now e_db_pdo failures to connect to the database are catchable
2020-06-19 11:15:56 -05:00
Cameron
5471a84746 Fixes #4111 Inconsistent results under some circumstances with e107::getDb()->retrieve(). Tests have been added to this commit. 2020-03-13 15:06:26 -07:00
Cameron
1925ce5264 Three dependencies updated and moved to vendor directory:
PHPMailer (upgraded to v6 - more testing required)
JsShink
Mysqldump-php
2020-02-29 11:56:05 -08:00
Nick Liu
8b354adf44
Don't spam database server with connections
- MOD: Silently ignore failures to e_db_mysql::close(); if it's failing, it's probably already closed
- FIX: Close the PDO or mysqli connection after each e_db_abstractTest test
- MOD: Changed class2.php's $sql variable to be hinted as an e_db instead of e_db_mysql
2020-01-19 14:33:11 +01:00
Nick Liu
72d3f07410
PHP 5.6 fixes for e_db_mysql
- FIX: Don't redefine MYSQL_* constants in e_db_pdo_class.php
- FIX: e_db_mysql::rowCount() could try to use mysql_num_rows() to count rows of a non-resource
- FIX: e_db_mysql::delete() stores the number of deleted rows in e_db_mysql::$mySQLrows
- FIX: e_db_abstractTest::testDb_Query() was fetching in PDO mode but shouldn't have been
- FIX: Typos in e_db_abstractTest::testDelete()
- MOD: Moved PDO-exclusive testBackup() from e_db_abstractTest to e_db_pdoTest
- FIX: e_db_mysqlTest now works in PHP 5.6 if the main e_db instance was in PDO mode but the test
       class initializes in legacy mode
- MOD: e_db_mysqlTest now asserts that PDO mode is not in use
- FIX: e_db_mysqlTest::testGetServerInfo() should now actually get a version number
- FIX: e_db_mysqlTest::testGetLastErrorNumber() has a different error code compared to PDO
- FIX: e_db_mysqlTest::testEscape() should actually get something from mysql_real_escape_string()
2020-01-19 12:30:23 +01:00
Nick Liu
be8f2bbeb6
Fixed PHP 7.3 warnings
- FIX: Silenced compact() in e107Test::testInitCore()
- FIX: Null check in e_db_pdo::makeTableDef()
- FIX: Null check in e_db_mysql::makeTableDef()
- FIX: userlogin::login() had this warning on line 148:
       "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
2020-01-18 18:52:20 +01:00
Nick Liu
91660a2c32
Test isolation fixes for e_db_abstractTest
Also needed a null check in e_db_pdo::db_Query()
2020-01-18 16:35:18 +01:00
Nick Liu
98911f0b8e
Guard type errors in e_db::insert() implementations 2020-01-18 11:05:08 +01:00
Nick Liu
ef34ef7ec8
Removed obsolete ALLOW_AUTO_FIELD_DEFS constant 2020-01-17 15:54:56 +01:00
Nick Liu
60aa3f34d4
Refactored e_db_pdo::copyRow() for Codeception
Fixes: "The method copyRow() has an NPath complexity of 252. The configured NPath complexity threshold is 200."
2019-12-28 10:57:51 +01:00
Nick Liu
fabb0c2757
e_db_pdo::copyRow() - Greatly decrease collision chance
Increased possible random strings for unique fields in e_db_pdo::copyRow() from 1000 to 59^11 (UserHandler::generateRandomString() "alphanumeric" should have 59 characters to choose from)

If a collision still happens, e_db_pdo::copyRow() retries up to 3 times for a successful copy.

Fixes: #3678
2019-12-27 21:54:11 +01:00
Nick Liu
8c7d32c523
Fixed MPREFIX regression caused by a4c6fd8b
Caused by: a4c6fd8b5bf268ae7032acb14f4476a192a48b62

- FIX: MySQL table prefix is lost due to cyclic e_db_pdo::database() call that loses the prefix and reverts back to the default prefix, MPREFIX or "e107_".
2019-12-23 21:11:59 +01:00
Cameron
ce7f3feb38 PDO class now used by default. mysql_class.php currently deprecated until it is modified to use mysqli. Install routine upgraded. Install logging vastly improved. 2019-06-03 15:27:36 -07:00
Cameron
be8d2fca28 Fixes #3800 Issue with DB structure update and database name containing hyphens. 2019-05-28 10:49:32 -07:00
Cameron
614711ff21 Database: Prevent gaps in PRIMARY index when using DUPLICATE_KEY_UPDATE with insert() method. 2019-02-25 18:51:49 -08:00
Cameron
8f19149adf Code cleanup
PDO class accepts bind params with select() method.
2019-02-21 17:29:49 -08:00
Cameron
bda78c39cc Moved deprecated method to traits file. 2019-02-18 13:08:46 -08:00
Cameron
7c9ceb79bf For the max() method when using $where 2019-02-18 12:54:43 -08:00
Cameron
b2fffa7838 Issue #3678 PDO fix for copyRow() with unique field keys. 2019-02-16 12:40:25 -08:00
Cameron
f5b16b5afb Closes #3674 PDO Don't overwrite e_db_pdo::$mySQLlastQuery with _getMySQLaccess() 2019-02-13 21:26:17 -08:00
Cameron
af50dcc5ff Minor fix 2019-02-13 14:06:00 -08:00
Cameron
a4c6fd8b5b Removed globals 2019-02-13 13:54:05 -08:00
Cameron
f34eeaf369 Refined debugging of PDO queries. 2019-02-13 11:35:28 -08:00
Cameron
c5d1e6876b copyRow() error check fix. 2019-02-13 11:16:48 -08:00
Cameron
a8d1541b9d Check for e_LEGACY_MODE moved to db legacy class. 2019-02-12 10:07:00 -08:00
Cameron
f5f2212b54 code cleanup 2019-02-11 17:55:16 -08:00
Cameron
3eec3d6029 Fix for BC constants. 2019-02-11 17:18:30 -08:00
Cameron
db4f82ba2f set default null value 2019-02-11 17:15:00 -08:00
Cameron
645ad037f5 More code cleanup 2019-02-11 16:56:37 -08:00
Cameron
762c8b5a1a Code cleanup 2019-02-11 16:32:41 -08:00
Cameron
4e6b68a709 new methods added to PDO class. 2019-02-11 16:19:07 -08:00
Cameron
dfea1cbce2 PDO class fixes. 2019-02-11 14:54:09 -08:00
Cameron
d9512cfb1b Legacy fixes. 2019-02-11 12:22:10 -08:00
Cameron
6cb92a37a7 Removed unused method 2019-02-11 10:09:04 -08:00
Cameron
4e9f47c8b4 PDO class optimization 2019-02-10 16:19:25 -08:00
Cameron
42147e2227 Traffic counters tweak. 2019-02-10 14:51:51 -08:00
Cameron
535fef8799 Disable debug class usage. 2019-02-10 13:54:17 -08:00
Cameron
f735292e3f More db class tweaks 2019-02-09 13:07:34 -08:00