User tests: Successful: Unsuccessful:
Category | ⇒ | Administration com_finder |
Status | New | ⇒ | Pending |
Sure, the text was written in the first ticket and not copied to the PR (only the ref. link).
Run Joomla on a host system with a non US locale, for example 'swedish'.
Create/Open an article and save it.
Silently save article.
com_finder will generate "Column count doesn't match value count at row 1" (Error Code: 1136.)
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
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 :)
Status | Pending | ⇒ | Needs Review |
Status is set on "Needs Review".
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.
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);
}
The line is still issue:
and should be replaced by . $db->quote($token->weight) . ', '
Status | Needs Review | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-05-24 19:16:32 |
Closed_By | ⇒ | Quy |
Set to "closed" on behalf of @Quy by The JTracker Application at issues.joomla.org/joomla-cms/17345
I can do the same for J3 as in PR joomla-framework/database#127
and then I/we can add a fix in com_finder.
Please take care of it. Framework is over my abilities. ;)
I did a PR to fix the problem in J3.
can you please provide Testing Instructions, what the PR solves, ...