Pending

User tests: Successful: Unsuccessful:

avatar gitlae
gitlae
30 Jul 2017

Pull Request for Issue #17114.

avatar joomla-cms-bot joomla-cms-bot - change - 30 Jul 2017
Category Administration com_finder
avatar gitlae gitlae - open - 30 Jul 2017
avatar gitlae gitlae - change - 30 Jul 2017
Status New Pending
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 30 Jul 2017

can you please provide Testing Instructions, what the PR solves, ...

avatar gitlae
gitlae - comment - 30 Jul 2017

Sure, the text was written in the first ticket and not copied to the PR (only the ref. link).

Steps to reproduce the issue

Run Joomla on a host system with a non US locale, for example 'swedish'.
Create/Open an article and save it.

Expected result

Silently save article.

Actual result

com_finder will generate "Column count doesn't match value count at row 1" (Error Code: 1136.)

System information (as much as possible)

Database Version 5.5.55-cll
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.6.16
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.7.3 Stable [ Amani ] 4-July-2017 08:03 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

Additional comments

Just casting a value to (float) will generate a locale aware floating-point number.
In Swedish ',' is used for decimal separation (3,14) and that will not work in an SQL statement.

The patch will at least fix the problem, might not be the perfect solution but it works for me :)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17345.
avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Nov 2017
Status Pending Needs Review
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 1 Nov 2017

Status is set on "Needs Review".

avatar Hackwar
Hackwar - comment - 21 May 2018

I unfortunately can't replicate this. I've been using German as the non-US language, which also uses ',' as decimal-seperator. The weight already was a float with '.' as decimal-seperator and even after casting with (float) it stayed that way. Is that still an issue? I tested this with 4.0-dev.

avatar brianteeman
brianteeman - comment - 21 May 2018

@Hackwar thanks for testing but this was a report of an issue in joomla 3 so could you please.test in that version and not j4

avatar ggppdk
ggppdk - comment - 21 May 2018

This is a real issue
you should never use

(float) value
in an SQL query as you cannot say in advance if at the server that this will be executed, the return value will have comma or dot

Always a dot should be used to send floats to DB, even if you fix the incorrect column count by quoting the comma-using float value you will get a truncated integer part to be saved

I think you missed the discussion at the already merged PR joomla-framework/database#127
by @csthomas that improved our
DatabaseDriver::escape() to use:

		if (is_float($text))
		{
			// Force the dot as a decimal point.
			return str_replace(',', '.', $text);
		}

https://github.com/csthomas/database/blob/d6e959fa08539feb79fab0d25997167bbe125c12/src/Mysqli/MysqliDriver.php#L300-L312

avatar csthomas
csthomas - comment - 21 May 2018

The line is still issue:

and should be replaced by . $db->quote($token->weight) . ', '

avatar Hackwar
Hackwar - comment - 24 May 2018

I created a new PR for this here: #20573

avatar joomla-cms-bot joomla-cms-bot - close - 24 May 2018
avatar Quy Quy - change - 24 May 2018
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2018-05-24 19:16:32
Closed_By Quy
avatar joomla-cms-bot
joomla-cms-bot - comment - 24 May 2018

Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/17345

avatar infograf768
infograf768 - comment - 25 May 2018

#20573 is for 4.0

@csthomas
You do the 3.x one?

avatar csthomas
csthomas - comment - 25 May 2018

I can do the same for J3 as in PR joomla-framework/database#127

avatar csthomas
csthomas - comment - 25 May 2018

and then I/we can add a fix in com_finder.

avatar infograf768
infograf768 - comment - 25 May 2018

Please take care of it. Framework is over my abilities. ;)

avatar csthomas
csthomas - comment - 1 Jun 2018

I did a PR to fix the problem in J3.

Add a Comment

Login with GitHub to post a comment