?
avatar rudisten1
rudisten1
23 Jul 2016

Steps to reproduce the issue

install joomla using a SQL Server db as the main database
create a new article content
associate the article to a single article menu item type
go to front end to see the new article

Expected result

Viewing the article in the front end

Actual result

The article is marked as expired even if no expiring date has ever been set up

System information (as much as possible)

joomla 3.6
SQL Server 2014
php 7.0
sqlsrv extension 4.0 non thread safe
IIS 7

Additional comments

avatar rudisten1 rudisten1 - open - 23 Jul 2016
avatar rudisten1 rudisten1 - edited - 23 Jul 2016
avatar rudisten1 rudisten1 - change - 23 Jul 2016
The description was changed
avatar rudisten1 rudisten1 - edited - 23 Jul 2016
avatar rudisten1 rudisten1 - change - 23 Jul 2016
The description was changed
avatar rudisten1 rudisten1 - edited - 23 Jul 2016
avatar rudisten1 rudisten1 - change - 23 Jul 2016
The description was changed
avatar rudisten1 rudisten1 - edited - 23 Jul 2016
avatar zero-24
zero-24 - comment - 23 Jul 2016

@rudisten1 please double check the current dates of your server and your local time (on your pc).

Is the content also marked on the backend as expired?

avatar rudisten1
rudisten1 - comment - 25 Jul 2016

The content is marked ONLY in the front end as expired.
It shouldn't be an issue with the current date, because having installed in the same server with a mysql db the issue didn't arise.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11277.

avatar zero-24
zero-24 - comment - 25 Jul 2016

@alikon can you have a look here? It sounds strange for me?

avatar pocketpc
pocketpc - comment - 25 Jul 2016

Having the same issues (with SQL Azure, same thing really), but I think I figured out why.

This happens because Joomla uses zero dates in the database to represent a date that hasn't been set before. Only MySQL supports zero dates. Other databases recommend using null for this purpose, but instead Joomla just leaves them all at the default date: 1900-01-01 00:00:00.000.

The hacky fix would be to tweak the SQL Server drivers (and by literal extension the SQL Azure drivers) to treat the default datetime as a zero date. I could probably throw together a pull request sometime this week.

The correct fix would be to switch to using null for unset dates (preferably with all databases to make transfers to/from MySQL easier). This would be a far more complicated project, better suited for a Joomla 3.7 or 4.0 than a 3.6.1, since you'd have to maintain compatibility with databases full of zero and default dates.

For now, you can mitigate by adding this CSS rule to your template to hide the "expired" label:
span.label-warning {
display: none;
}

Or by setting an expiration date in the distant future for all your articles.

avatar williamsandy
williamsandy - comment - 9 Aug 2016

This can be fixed by changing the nullDate property of the JDatabaseDriverSqlsrv class from '1900-01-01 00:00:00' to '1900-01-01 00:00:00.000' on line 54.

In MSSQL we have to consider the milliseconds as well.

You will also need to apply the patch "PR 11396" if you are on Joomla 3.6.2


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11277.

avatar williamsandy
williamsandy - comment - 1 Sep 2016

Looking into this issue, my fix suggested above will fix this particular issue but not fix the underlying problems. The root issue here is that in the Joomla database for MSSQL is that there is no consistency in how we are storing datetime values in the database. If we are trying to be consistent with how MySQL deals with datetimes then we should be using the newer SQL data type datetime2 and using a precision of 0 for the milliseconds.

In the database, most of the core tables use the old datetime SQL datatype which stores the milliseconds by default to a precision of 3 and that is why we have this expired article issue. Only user_notes table and the tables for the com_finder component use the newer datetime data type datetime2.

I can understand for Joomla 2.5 why we may have used datetime data type, but support for SQL 2000, SQL 2005 and SQL 2008 is long dead now. Also, it is general recommended to use datetime2 instead of datetime whenever possible due to the simple fact that it is more flexible and a less expensive option as you will be saving on storage space as well.

I suggest updating the sqlazure joomla.sql install script so that we use datetime2(0) anytime we use datetime in this database script. This will solve this issue with the 'expired' labels for articles appearing and also bring it in line with how MySQL stores datetimes.

@waader what do you think.

avatar waader
waader - comment - 1 Sep 2016

Following the documentation Mssql 2008R2 SP3 is the minimum required version - https://docs.joomla.org/Technical_requirements/en. And as far as I know this version already supports datetime2. So there would be no b/c break.

avatar csthomas
csthomas - comment - 17 Feb 2017

Welcome to test #14123

avatar zero-24 zero-24 - change - 17 Feb 2017
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-02-17 21:50:36
Closed_By zero-24
avatar zero-24 zero-24 - close - 17 Feb 2017

Add a Comment

Login with GitHub to post a comment