? ? Pending

User tests: Successful: Unsuccessful:

avatar shim-sao
shim-sao
31 Aug 2020

Pull Request for Issue # .

Summary of Changes

Add default value 0 to the "hits" field in the admin form of the article.

Testing Instructions

Create an article, duplicate it.
In this case trying to save the duplicated article cause : '' is not a valid integer on save
The field hits is blank and is not be set to a valid integer in the query

This not happen all the time. Why ?

An integer must have a default valid value if it is save in the database or be set to NULL if it is allowed in the table

Actual result BEFORE applying this Pull Request

Saving article cause : '' is not a valid integer

Expected result AFTER applying this Pull Request

Article saved with default hits to 0

Documentation Changes Required

avatar shim-sao shim-sao - open - 31 Aug 2020
avatar shim-sao shim-sao - change - 31 Aug 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Aug 2020
Category Administration com_content JavaScript Repository NPM Change
avatar shim-sao shim-sao - change - 31 Aug 2020
Title
[4.0] Saving article cause : '' is not a valid integer
[4.0] Saving article cause : hits = '' is not a valid integer
avatar shim-sao shim-sao - edited - 31 Aug 2020
avatar shim-sao shim-sao - change - 31 Aug 2020
The description was changed
avatar shim-sao shim-sao - edited - 31 Aug 2020
avatar BertaOctech
BertaOctech - comment - 3 Sep 2020

Hi.

I have not been able to reproduce the issue.

I have created 2 articles, I have visited only one of them. In this way I have one article with hits = 0 and another one with hits > 0.

In both cases, when I used "Save as Copy" a new article was created, and the message "Article saved." appeared.

I have tried in Chrome and Firefox.


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

avatar shim-sao shim-sao - change - 5 Sep 2020
Labels Added: Information Required NPM Resource Changed ?
avatar joomla-cms-bot joomla-cms-bot - change - 5 Sep 2020
Category Administration com_content JavaScript Repository NPM Change Administration com_content
avatar shim-sao shim-sao - change - 5 Sep 2020
Labels Removed: NPM Resource Changed
avatar Quy Quy - test_item - 6 Sep 2020 - Tested successfully
avatar Quy
Quy - comment - 6 Sep 2020

I have tested this item successfully on a5588af

To reproduce:

Edit an article.
Go to Publishing tab.
Use browser's inspector to change the value of Hits to empty string.
Click Save button.


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

avatar ceford ceford - test_item - 7 Sep 2020 - Tested successfully
avatar ceford
ceford - comment - 7 Sep 2020

I have tested this item successfully on a5588af

Followed the procedure given by BertaOctech


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

avatar Quy Quy - change - 7 Sep 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 7 Sep 2020

RTC


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

avatar shim-sao
shim-sao - comment - 7 Sep 2020

Indeed this is the fastest way to reproduce the error.
I have only described in which case it occurred on my side ... it is not systematic as I specified.

I made the most obvious correction but for me there is clearly a problem in the form validation process on the server side.
Since the field is defined as an integer, even without a default value, it should be initialized to 0 no matter what, '' is not an integer.

Maybe there is an hidden error in the integer definition filter.

I think if this happens for this field, then all forms with none initialized integer should be reviewed.


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

avatar shim-sao
shim-sao - comment - 8 Sep 2020

This error is no need to be reproduce for this patch but...

I checked the category hits field and the default to 0 is present.

If you remove the default of the field 'hits' (category or article) and follow the @Quy instruction, you will get the error.
You can also enter a string instead of an integer and the string will be convert to empty string.
Incorrect integer value: '' for column 'hits' at row 1

This kind of error must not happen on the server side validation because everybody can make a form like he want, specially with the API

The form validation does not make its job if a value is set to string for an integer with no default, the default should be 0 on all case or the form is not valid


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

avatar shim-sao shim-sao - change - 8 Sep 2020
Labels Added: ?
Removed: Information Required
avatar laoneo laoneo - change - 9 Sep 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-09-09 07:58:16
Closed_By laoneo
avatar laoneo laoneo - close - 9 Sep 2020
avatar laoneo laoneo - merge - 9 Sep 2020
avatar laoneo
laoneo - comment - 9 Sep 2020

Thanks!

Add a Comment

Login with GitHub to post a comment