User tests: Successful: Unsuccessful:
Pull Request for Issue #26964 (comment).
Change names of bind variables in users model so they still are unambiguous when range filters are used for both columns register date and last visit date.
In the users list view having more than 1 user, set any datetime filter like e.g. "today" on each of the columns "Registration Date" and "Last Visit Date", so that for both columns a filter is applied.
No error, filter is applied.
HTTP code 500, no further error message in UI. In PHP log with error log into file on and error reporting = maximum following message 2 times:
PHP Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in /home/richard/lamp/public_html/joomla-cms-4.0-dev/libraries/vendor/joomla/database/src/Mysqli/MysqliStatement.php on line 430
None.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_users |
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
RTC.
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-11-04 09:44:44 |
Closed_By | ⇒ | laoneo |
Thanks!
@richard67
PHP Warning is gone but I have an error here when using last visit date of today
or in the last week
My superadmin has visited today
When no filter I get
After waiting for a while and reloading the page, it is the Select Registration date filter which gives false results. I.e. it works without any filter or with more than a year ago
....
Confused...
@infograf768 I‘ll check tonight after work (German time).
I always asked myself when working in that file why for the last visit date there is this check is_string here https://github.com/richard67/joomla-cms/blob/7d1a1964d0780b61bbe5a077f593b6cba7a229fc/administrator/components/com_users/Model/UsersModel.php#L422 but for the registration date there is no such condition. Does anyone have any idea what this is (or was) good for?
Ah, I think I know why. It was for the null date check. So I have to fix the last visit date too, not only the registration date. Am working on a PR.
@infograf768 I've found an issue when filtering for last visit date = "never". But your issue with registration date I can't reproduce. Could it be a timezone issue? What timezone have you set for the server and the user who is logged in to backend? I have set server time zone to Europe/Berlin in Global Configuration, and user time zone I haven't set, so the one of the server is used.
not on desktop right now but issue is both server set to utc or paris
I see another issue in the queries but this error must have been there before my nulldate changes.
When I enter a text in the search box and in addition select one of the time range filters for registered date or last visit date, I would expect that all conditions have to be fulfilled, i.e. search text has to be found AND time range fits.
But for the search sting "orWhere" is used here: https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_users/Model/UsersModel.php#L372.
If there is a date range filter, it is appended then to the query with "OR" where it should be "AND", see the query from the debug module:
SELECT a.*
FROM `j4ux0_users` AS a
WHERE
(
(`a`.`name` LIKE :name) OR
(`a`.`username` LIKE :username)) OR
(`a`.`email` LIKE :email) OR `a`.`lastvisitDate` IS NULL
ORDER BY `a`.`name` ASC LIMIT 20
That's why a combination of search text and any of the date range filters does not work.
Beside the fact that I've never seen that orWhere before: Does anybody know how to get out of this mess so the last "OR" before the a
.lastvisitDate
becomes and "AND"? @Quy @SharkyKZ @wilsonge Any idea?
extendWhere
can help sorry for brevity but i'm running out of time now
@infograf768 Sure it is the registration date and not the last visit date which makes you the problems? I ask because I found errors for the last visit date but not for the registration date.
@alikon Do you think you can help later? I think it needs also to fix these "orWhere" things with "extendWhere", because as you can see the brackets set by the "orWhere" are not right.
sure...
extendWhere()
won't work here because it requires at least one WHERE
condition.
@SharkyKZ Any other idea? We can't be sure if there is a where before or after because any of the filters or the text search might be used or might not be used. But like it is now, the query is wrong, or I understand the functionality of the text search together with other filters wrong.
Just need to revert that part to how it was. I'll make a PR.
@Quy @alikon Please test.