? Success

User tests: Successful: Unsuccessful:

avatar Taliman
Taliman
4 May 2014

#3556
J! 3.3 Stable
File : /administrator/components/com_content/models/article.php

For some reasons, it happens that the array
$associations[$item->language] = $item->id;
ends with a null element

Hence,
->where('id IN (' . implode(',', $associations) . ')');
leads to something like "id IN (3188, )"
which gives an error because of the ending comma.

Fix :
after the line :
$associations[$item->language] = $item->id;
add an array_filter :
$associations = array_filter($associations);

avatar Taliman Taliman - open - 4 May 2014
avatar Taliman Taliman - change - 4 May 2014
Labels
avatar Taliman Taliman - change - 4 May 2014
Labels Added: ?
avatar Bakual Bakual - change - 4 May 2014
Title
Update article.php
Incorrect SQL on deleting an article's associations
avatar elkuku
elkuku - comment - 4 May 2014

Can't we just "deactivate" Lady Travis for the time she has her ... hickups? I believe those failures might confuse new contributors, they might think that they did something wrong :wink:

avatar mbabker
mbabker - comment - 4 May 2014

There's a PR fixing it already. Just need testers.

On Sunday, May 4, 2014, Nikolai Plath notifications@github.com wrote:

Can't we just "deactivate" Lady Travis for the time she has her ...
hickups https://travis-ci.org/joomla/joomla-cms/builds/24397721? I
believe those failures might confuse new contributors, they might think
that they did something wrong [image: :wink:]


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

avatar infograf768
infograf768 - comment - 5 May 2014

Could you create a tracker on Joomlacode explaining how to test this and cross referencing.

avatar infograf768
infograf768 - comment - 19 May 2014

@Tallman

We DO need testing instructions to reproduce this issue...
This code is not only used for article but in other core joomla components: contacts and newsfeeds

avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels
avatar brianteeman brianteeman - change - 2 Sep 2014
Category SQL
avatar vdespa
vdespa - comment - 14 May 2015

This issues is already one year old without any visible progress. There are no testing / replication instructions.

The proposed fix should fix the error but not the cause. Without being able to replicate the bug, it is hard to say if this is the right approach.

Closing the issue and there is not progress and no updates from the OP. Thanks @all.

avatar vdespa vdespa - change - 14 May 2015
Status Pending Information Required
avatar Taliman
Taliman - comment - 14 May 2015

The bug is still present in 3.4.1 in File : /administrator/components/com_content/models/article.php

Here is the hack we had to do :

$associations[$item->language] = $item->id;
$associations = array_filter($associations); // Delete the null element that produces the error, otherwise :
// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3
// SQL=DELETE FROM qb4gr_associations WHERE context='com_content.item' AND id IN (4694,)

if ($associations) // Only if $associations, otherwise error :
// You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3
// SQL=DELETE FROM qb4gr_associations WHERE context='com_content.item' AND id IN ()
{
// Deleting old association for these items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete('#__associations')
->where('context=' . $db->quote('com_content.item'))
->where('id IN (' . implode(',', $associations) . ')');
$db->setQuery($query);
$db->execute();

if ($error = $db->getErrorMsg())
{
    $this->setError($error);

    return false;
}

}

avatar vdespa
vdespa - comment - 14 May 2015

I understand that you are still having this issue. But can you provide the steps necessary to replicate this issue on a clean Joomla installation?

avatar brianteeman
brianteeman - comment - 29 Jul 2015

This issue will be closed automatically if further information how to replicate this issue is not provided.


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

avatar roland-d roland-d - change - 20 Aug 2015
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2015-08-20 18:52:57
Closed_By roland-d
avatar roland-d roland-d - close - 20 Aug 2015
avatar roland-d
roland-d - comment - 20 Aug 2015

Closing this issue due to lack of testing instructions and the PR has merge conflicts. Feel free to open the issue anytime when you have test instructions and fixed the merge conflict.

Thank you for your contribution.


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

Add a Comment

Login with GitHub to post a comment