? Pending

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
1 Jun 2018

Pull Request for Issue #17114 and PR #17345

Summary of Changes

Correctly escape the float value and always use the dot as a decimal point.
This is a copy of joomla-framework/database#127

Testing Instructions

Take a look at #17114

Phpunit tested it successfully.
Merge by code review.

avatar csthomas csthomas - open - 1 Jun 2018
avatar csthomas csthomas - change - 1 Jun 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jun 2018
Category Libraries Postgresql MS SQL Unit Tests
avatar csthomas csthomas - change - 1 Jun 2018
The description was changed
avatar csthomas csthomas - edited - 1 Jun 2018
avatar csthomas
csthomas - comment - 30 Jun 2018

As travis and apache2 (in general) use LANG=C, we do not see any errors.

When we run phpunit we can change environment variable to test joomla before that patch.
There are many errors (25) and 2 related to the database escape function.

The simpler way to test it, is to run phpunit as
Before patch there is 25 errors:
LANG=pl_PL php -f libraries/vendor/phpunit/phpunit/phpunit
After patch there is 23 errors.

There were 25 failures:

1) JHtmlNumberTest::testBytes with data set #17 ('1.1258999068426E+15', 1125899906842624, '')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'1.1258999068426E+15'
+'1,1258999068426E+15'

.../staging/tests/unit/suites/libraries/cms/html/JHtmlNumberTest.php:242

2) JDatabaseDriverTest::testQuoteFloat
Tests handling of float with escaping (default).
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-''-3.14-''
+''-3,14-''

.../staging/tests/unit/suites/libraries/joomla/database/JDatabaseDriverTest.php:451

3) JFilterInputTest::testCleanByCallingMember with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:816

4) JFilterInputTest::testCleanByCallingMember with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:816

5) JFilterInputTest::testCleanWithImgWhitelisted with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:964

6) JFilterInputTest::testCleanWithImgWhitelisted with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:964

7) JFilterInputTest::testCleanWithClassWhitelisted with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1078

8) JFilterInputTest::testCleanWithClassWhitelisted with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1078

9) JFilterInputTest::testCleanWithImgAndClassWhitelisted with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1199

10) JFilterInputTest::testCleanWithImgAndClassWhitelisted with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1199

11) JFilterInputTest::testCleanWithDefaultBlackList with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1441

12) JFilterInputTest::testCleanWithDefaultBlackList with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1441

13) JFilterInputTest::testCleanWithImgBlackList with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1542

14) JFilterInputTest::testCleanWithImgBlackList with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1542

15) JFilterInputTest::testCleanWithClassBlackList with data set "float_02" ('float', 20.2, 20.2, 'From generic cases')
From generic cases
Failed asserting that 20.0 matches expected 20.2.

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1763

16) JFilterInputTest::testCleanWithClassBlackList with data set "float_11" ('float', array(1.0, 3.1, 6.2), array(1.0, 3.1, 6.2), 'From generic cases')
From generic cases
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
     0 => 1.0
-    1 => 3.1
-    2 => 6.2
+    1 => 3.0
+    2 => 6.0
 )

.../staging/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php:1763

17) JGoogleEmbedMapsTest::testGetHeader
Failed asserting that '<script type="text/javascript">function asynchronouscallback() {var mapOptions = {zoom: 8,center: new google.maps.LatLng(37,7749295,-122,4194155),mapTypeId: google.maps.MapTypeId.SATELLITE,"mapkey1":5,"mapkey2":{"subkey":"subvalue"}};var map = new google.maps.Map(document.getElementById('MAPID'), mapOptions);var marker;marker = new google.maps.Marker({position: new google.maps.LatLng(37,7749295,-122,4194155),map: map,title:'Home',"centerkey":"value"});marker = new google.maps.Marker({position: new google.maps.LatLng(25,75),map: map,title:'25, 75',});alert();}window.onload=function() {var script = document.createElement("script");script.type = "text/javascript";script.src = 'http://maps.googleapis.com/maps/api/js?key=123456&sensor=true&callback=asynchronouscallback';document.body.appendChild(script);};</script>' contains "center: new google.maps.LatLng(37.7749295,-122.4194155)".

.../staging/tests/unit/suites/libraries/joomla/google/JGoogleEmbedMapsTest.php:621

18) JArrayHelperTest::testToString with data set "single dimension 1" (array(12, 1.29999, 'A Test String'), null, null, false, 'integer="12" float="1.29999" ...tring"', 'Should turn array into single...faults', true)
Should turn array into single string with defaults
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'integer="12" float="1.29999" string="A Test String"'
+'integer="12" float="1,29999" string="A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

19) JArrayHelperTest::testToString with data set "single dimension 2" (array(12, 1.29999, 'A Test String'), ' = ', null, true, 'integer = "12"float = "1.2999...tring"', 'Should turn array into single...spaces', false)
Should turn array into single string with " = " and no spaces
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'integer = "12"float = "1.29999"string = "A Test String"'
+'integer = "12"float = "1,29999"string = "A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

20) JArrayHelperTest::testToString with data set "single dimension 3" (array(12, 1.29999, 'A Test String'), ' = ', ' then ', true, 'integer = "12" then float = "...tring"', 'Should turn array into single...ements', false)
Should turn array into single string with " = " and then between elements
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'integer = "12" then float = "1.29999" then string = "A Test String"'
+'integer = "12" then float = "1,29999" then string = "A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

21) JArrayHelperTest::testToString with data set "multiple dimensions 1" (array(array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String')), null, null, false, 'integer="12" float="1.29999" ...tring"', 'Should turn multiple dimensio...string', true)
Should turn multiple dimension array into single string
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'integer="12" float="1.29999" string="A Test String" integer="12" float="1.29999" string="A Test String" integer="12" float="1.29999" string="A Test String"'
+'integer="12" float="1,29999" string="A Test String" integer="12" float="1,29999" string="A Test String" integer="12" float="1,29999" string="A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

22) JArrayHelperTest::testToString with data set "multiple dimensions 2" (array(array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String')), ' = ', null, false, 'integer = "12"float = "1.2999...tring"', 'Should turn multiple dimensio...spaces', false)
Should turn multiple dimension array into single string with " = " and no spaces
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'integer = "12"float = "1.29999"string = "A Test String"integer = "12"float = "1.29999"string = "A Test String"integer = "12"float = "1.29999"string = "A Test String"'
+'integer = "12"float = "1,29999"string = "A Test String"integer = "12"float = "1,29999"string = "A Test String"integer = "12"float = "1,29999"string = "A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

23) JArrayHelperTest::testToString with data set "multiple dimensions 3" (array(array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String')), ' = ', ' ', false, 'integer = "12" float = "1.299...tring"', 'Should turn multiple dimensio... space', false)
Should turn multiple dimension array into single string with " = " and a space
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'integer = "12" float = "1.29999" string = "A Test String" integer = "12" float = "1.29999" string = "A Test String" integer = "12" float = "1.29999" string = "A Test String"'
+'integer = "12" float = "1,29999" string = "A Test String" integer = "12" float = "1,29999" string = "A Test String" integer = "12" float = "1,29999" string = "A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

24) JArrayHelperTest::testToString with data set "multiple dimensions 4" (array(array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String'), array(12, 1.29999, 'A Test String')), ' = ', null, true, 'firstinteger = "12"float = "1...tring"', 'Should turn multiple dimensio...er key', false)
Should turn multiple dimension array into single string with " = " and no spaces with outer key
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'firstinteger = "12"float = "1.29999"string = "A Test String"secondinteger = "12"float = "1.29999"string = "A Test String"thirdinteger = "12"float = "1.29999"string = "A Test String"'
+'firstinteger = "12"float = "1,29999"string = "A Test String"secondinteger = "12"float = "1,29999"string = "A Test String"thirdinteger = "12"float = "1,29999"string = "A Test String"'

.../staging/tests/unit/suites/libraries/joomla/utilities/JArrayHelperTest.php:1677

25) JDatabaseQuerySqliteTest::testDateAdd with data set "Add microseconds" ('2008-12-31 23:59:59', '53', 'microseconds', 'datetime('2008-12-31 23:59:59...onds')')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'datetime('2008-12-31 23:59:59', '+0.053 seconds')'
+'datetime('2008-12-31 23:59:59', '+0,053 seconds')'

.../staging/tests/unit/suites/database/driver/sqlite/JDatabaseQuerySqliteTest.php:101

FAILURES!
Tests: 15674, Assertions: 10339, Failures: 25, Skipped: 396, Incomplete: 21.
avatar csthomas csthomas - change - 30 Jun 2018
The description was changed
avatar csthomas csthomas - edited - 30 Jun 2018
avatar csthomas
csthomas - comment - 18 Jul 2018

After this PR will be merged then we can fix problem for com_finder in:

@infograf768 @Hackwar Because nobody is interested in this PR, I will close this PR soon.

avatar ggppdk ggppdk - test_item - 18 Jul 2018 - Tested successfully
avatar ggppdk
ggppdk - comment - 18 Jul 2018

I have tested this item successfully on d6d4d5e

Tested on MySQL, code review on others

Also relevant PR joomla-framework/database#127


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

avatar ggppdk
ggppdk - comment - 7 Aug 2018

Anyone ?

avatar infograf768
infograf768 - comment - 7 Aug 2018

@csthomas @ggppdk
I am sorry, but this is over my head.

avatar frankmayer frankmayer - test_item - 7 Aug 2018 - Tested successfully
avatar frankmayer
frankmayer - comment - 7 Aug 2018

I have tested this item successfully on d6d4d5e

Tested on MySQLi, code review on others


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

avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Aug 2018
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 7 Aug 2018

Ready to Commit after two successful tests.

avatar mbabker mbabker - change - 9 Aug 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-08-09 12:49:08
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 9 Aug 2018
avatar mbabker mbabker - merge - 9 Aug 2018
avatar frankmayer
frankmayer - comment - 9 Aug 2018

@csthomas No need to do the correction on the indexer (as you stated in an earlier post). It's already done as part of my PR #12253, which is in RTC state.

Add a Comment

Login with GitHub to post a comment