User tests: Successful: Unsuccessful:
Pull Request for Issue #24535 (part).
Replacement for #26469 (part).
This Pull Request (PR) fixes all datetime columns of database table #__users
so there will not be any Invalid value '0000-00-00 00:00:00' for datetime
error anymore on MySQL 5.7 or later when strict mode is enabled.
The registerDate
is handled like columns created
or created_time
at other places with other recently merged PR's for datetime columns.
The lastvisitDate
column was subject of a discussion in the first PR I made for com_users for that purpose, #26469 , and also oin Glip, and finally it turned out that we can remove the reference for the lastvisitDate
column to #__ucm_content
, what this PR here does, too, and so can make this column nullable, which is more logical than like it was in PR #26469 .
The lastResetTime
(time of last password reset) column of the users table will also allow null values.
The user notes part which was part of PR #26469 has been separated into a separate PR, #26609 , which meanwhile has been merged, so user notes are not handled in this PR here.
Testers please report back the database kind (MySQL or PostgreSQL) on which you have tested.
If you have both MySQL and PostgreSQL, please test on both if possible.
Test 1: New installation
configuration.php
and delete all Joomla database tables in PhpMyAdmin or PhpPgAdmin (depending on your database type).datetime
/timestamp without timezone
columns.Result: See section "Expected result" below.
Test 2: Update sql script
installation/sql/mysql/joomla.sql
into the SQL command window but don't execute the commands yet:SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
This switches off strict mode to the SQL will run on MySQL 5.7 or later.
administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-10-17.sql
or administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-10-17.sql
(depending on your database type) into the SQL command window, in case of MySQL below the previously pasted commands, but don't execute the commands yet.#__
by your database prefix in the SQL statements pasted before in the SQL input window.datetime
/timestamp without timezone
columns.Result: See section "Expected result" below.
New Installation
Users work as well as without this PR. In a MySQL database there are no columns of data type datetime
having value '0000-00-00 00:00:00' in table #__users
, and there is no invalid default value anymore in MySQL >= 5.7 with strict mode on. On PostgreSQL there are no columns of data type timestamp without time zone
having value '0000-00-00 00:00:00' in this table.
Update sql script
The statements are processed without error. The expected result is the same as for a new installation.
New Installation
On MySQL same as expected, but the default value '0000-00-00 00:00:00' of database columns of data type datetime
is invalid in MySQL >= 5.7 with strict mode on, and there might be values '0000-00-00 00:00:00'. On postgreSQL same as expected, but there might be values '1970-01-01 00:00:00' in this table.
Maybe core developer docs and extension developer docs should be updated to encourage them not to use '0000-00-00 00:00:00' on MySQL anymore but use real NULL and not abuse '1970-01-01 00:00:00' on PostgreSQL as a speudo null date anymore and use real NULL values also there.
Status | New | ⇒ | Pending |
Category | ⇒ | SQL Administration com_admin Postgresql Installation |
Labels |
Added:
?
|
Category | SQL Administration com_admin Postgresql Installation | ⇒ | Administration SQL com_admin Postgresql com_users Front End Installation Libraries |
Title |
|
Adapted to latest changes for prepared statements and so solved merge conflicts.
Forgive me if I haven't tested this correctly. Here's what I did.
I've been using my J4 all day testing patches (and reverting them). Hopefully that is ok but you are very specific about a brand new instance.
Before the patch, as expected 00 datetimes which fail strict MySql.
After the patch when I edit a user and then save I get:
Save failed with the following error: Column 'lastvisitDate' cannot be null
New users seem to work fine. The last visit date is still saved as
0000-00-00 00:00:00
If you let me know if I am testing correctly I am happy to retest this.
Ah I see why it's 8mportsnt. No problems I will restest in a little while.
I have tested this item
Thanks for your patience. Great instructions. Really good pull request, strict mode is really annoying. Works well I couldn't find any issues with block/unblock/notes/batch/changing user group/sorting. Thanks for this.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-11-02 10:06:15 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
|
Thanks!
Thanks too.
500 No data supplied for parameters in prepared statement No data supplied for parameters in prepared statement
Call stack
--
# | Function | Location
1 | () | JROOT\administrator\components\com_users\View\Users\HtmlView.php:107
2 | Joomla\Component\Users\Administrator\View\Users\HtmlView->display() | JROOT\libraries\src\MVC\Controller\BaseController.php:690
3 | Joomla\CMS\MVC\Controller\BaseController->display() | JROOT\administrator\components\com_users\Controller\DisplayController.php:120
4 | Joomla\Component\Users\Administrator\Controller\DisplayController->display() | JROOT\libraries\src\MVC\Controller\BaseController.php:728
5 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT\libraries\src\Dispatcher\ComponentDispatcher.php:146
6 | Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() | JROOT\libraries\src\Component\ComponentHelper.php:383
7 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT\libraries\src\Application\AdministratorApplication.php:117
8 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT\libraries\src\Application\AdministratorApplication.php:160
9 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT\libraries\src\Application\CMSApplication.php:242
10 | Joomla\CMS\Application\CMSApplication->execute() | JROOT\administrator\includes\app.php:63
11 | require_once() | JROOT\administrator\index.php:36
Will check after sleep.
@roland-d Because you had tested my PR #26469 for the same thing, could you test this here, too? Thanks in advance.