?
avatar germi
germi
25 Feb 2016

Steps to reproduce the issue

just open any native joomla extension (i.e. com_content) in the backend. asume you have a list of articles (at least one)
if you want to publish (for example) an article (or various), you need to select the articles first (otherwise it will pop up an alert telling you to make a selection from the list first)
now, CHECK the checkbox on the left of an article to select it, but then UNCHECK it (so there are NO articles selected). now click the publish button (or unpublish, or delete.. whatever action that is supposed to work with a list of articles selected). it WILL let you submit that action, even if you should not be able to.

Expected result

action should not be able to be submitted if no articles are selected

Actual result

action is submitted

System information (as much as possible)

it's pretty clear what the error is, just looking at the console (in Chrome for instance).
the whole "allow or deny" submit action is based on the value of the hidden input called "boxchecked", which has been there forever in all joomla versions.
this input is supposed to have a value of 1 when there are boxes checked, and 0 when there are none (and in this case, the submit function sees that there are no boxes and doesn't let you to submit)

when you use the GLOBAL checkbox ( the one that selects/unselects all items), it works FINE. the value of boxchecked changes from 0 to 1 and from 1 to 0. all good.

the problem comes with single box checking. in this case, the value of boxchecked, as you go checking and unchecking single articles, changes to "01" and then to "01-1", then "01-11", and "01-11-01" and so forth (this would be checking a few times)

to me, the reason is pretty clear: in this case, the system is suposes to be "adding 1" or "substracting 1" from that value, therefore should be switching from 1 to 0 and from 0 to 1.
but at some point, I'm sure this "+1" and "-1" operation is being done with STRINGS instead of INTEGERS.
Hence the bug. the operation "0" + "1" equals "01" if we're using strings. and then "01" + "-1" equals "01-1"
(instead of what you would want to be doing, which is 0+1 = 1 and 1-1 = 0)

there you go. I've checked this on Joomla 3.4.8, on many installations, and the bug is always there. so it seems a bug in joomla core, in the JHTML::_('grid.id') function probably.

Additional comments

this bug wasn't there before, i'm pretty sure. I think this should be added to 3.4.9 because it affects all extensions using this, either native or third-party

avatar germi germi - open - 25 Feb 2016
avatar brianteeman brianteeman - change - 25 Feb 2016
Status New Confirmed
Labels Added: ?
avatar brianteeman
brianteeman - comment - 25 Feb 2016

Confirmed and added the Blocker tag
@dgt41 was this from something you were working on?


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

avatar brianteeman brianteeman - change - 25 Feb 2016
Labels
avatar infograf768
infograf768 - comment - 25 Feb 2016

I could reproduce once, after using first the icon to publish/unpublish an item. But no more since.

avatar brianteeman
brianteeman - comment - 25 Feb 2016

Same here - and now i cant even reproduce it in a new browser

On 25 February 2016 at 15:51, infograf768 notifications@github.com wrote:

I could reproduce once, after using first the icon to publish/unpublish
and item. But no more since.


Reply to this email directly or view it on GitHub
#9213 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar germi
germi - comment - 25 Feb 2016

I'm testing with Chrome, and for me it happens 100% of times...

avatar bertmert
bertmert - comment - 25 Feb 2016

I cannot reproduce with chrome and current staging at all.

Did you all test with current staging, too?

core.js (I've tested with uncompressed)
lte 3.4.8 line 223

form.boxchecked.value += isitchecked ? 1 : -1;

There I think your described concatenating of strings is possible. (Not sure.)

staging (3.5.?, 2016-02-23) line 222

form.boxchecked.value = isitchecked ? parseInt(form.boxchecked.value) + 1 : parseInt(form.boxchecked.value) - 1;

This should be always an integer result.

avatar brianteeman
brianteeman - comment - 26 Feb 2016

Sorry to say that I can no longer replicate this

@germi please can you retest with the current staging (download from https://github.com/joomla/joomla-cms/archive/staging.zip)
Make sure you completely clear your browser cache etc


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

avatar brianteeman brianteeman - change - 26 Feb 2016
Status Confirmed Information Required
Labels Removed: ?
avatar germi
germi - comment - 26 Feb 2016

it does NOT happen for me in this staging (v 3.5 beta2)
so it appears to be fixed.

but it does happen (to me, 100% of times) on current stable version 3.4.8.
I tried in every installation of Joomla 3.4.8 I have, and it happens always.

avatar brianteeman brianteeman - close - 26 Feb 2016
avatar brianteeman
brianteeman - comment - 26 Feb 2016

OK thanks - I will close it then as it has obviously been fixed somewhere

avatar brianteeman brianteeman - change - 26 Feb 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-02-26 11:17:10
Closed_By brianteeman
avatar brianteeman brianteeman - close - 26 Feb 2016
avatar stell
stell - comment - 15 Mar 2016

Problem still exists in 3.4.8
Chrome 49

Quick fix in core-uncompressed.js:
Change this:
form.boxchecked.value += isitchecked ? 1 : -1;
to this
form.boxchecked.value = parseInt(form.boxchecked.value) + (isitchecked ? 1 : -1);

avatar brianteeman
brianteeman - comment - 15 Mar 2016

@stell please can you test with 35rc3. If you can confirm it then e can re-open this. Otherwise we will assume it has been fixed already


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

avatar stell
stell - comment - 15 Mar 2016

I fixed it by doing this:
form.boxchecked.value = parseInt(form.boxchecked.value) + (isitchecked ? 1 : -1);

In 35rc3 it's fixed like this:
form.boxchecked.value = isitchecked ? parseInt(form.boxchecked.value) + 1 : parseInt(form.boxchecked.value) - 1;

But its still buggy in 3.4.8 which is live.

avatar brianteeman
brianteeman - comment - 15 Mar 2016

Glad to hear it is fixed with 3.5rc3 - we hope the final release will be
very soon

On 15 March 2016 at 14:36, Tom Bohacek notifications@github.com wrote:

I fixed it by doing this:
form.boxchecked.value = parseInt(form.boxchecked.value) + (isitchecked ? 1
: -1);

In 35rc3 it's fixed like this:
form.boxchecked.value = isitchecked ? parseInt(form.boxchecked.value) + 1
: parseInt(form.boxchecked.value) - 1;

But its still buggy in 3.4.8 which is live.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#9213 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar stell
stell - comment - 15 Mar 2016

So people will need to wait and go to 3.5 to fix this?

avatar brianteeman
brianteeman - comment - 15 Mar 2016

yes - thats the way it works but the release should be very very soon

On 15 March 2016 at 14:41, Tom Bohacek notifications@github.com wrote:

So people will need to wait and go to 3.5 to fix this?


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#9213 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar stell
stell - comment - 15 Mar 2016

I'm wondering why this was not alerted by the joomla selenium webtests. I think there are many tests that use the toggle checkbox.

avatar brianteeman
brianteeman - comment - 15 Mar 2016

Sorry I have no idea about the unit testing

On 15 March 2016 at 14:48, Tom Bohacek notifications@github.com wrote:

I'm wondering why this was not alerted by the joomla selenium webtests. I
think there are many tests that use the toggle checkbox.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#9213 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

Add a Comment

Login with GitHub to post a comment