diff --git a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php index e9c0c8d7685166001b524af995d62bf6b3c84011..fd319e97b6ab7e87c88f4c899b0c1b49e41f86ab 100644 --- a/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php +++ b/app/code/Magento/Ui/Component/Form/Element/DataType/Date.php @@ -60,6 +60,7 @@ class Date extends AbstractDataType public function prepare() { $config = $this->getData('config'); + if (!isset($config['storeTimeZone'])) { $storeTimeZone = $this->localeDate->getConfigTimezone(); $config['storeTimeZone'] = $storeTimeZone; @@ -67,7 +68,7 @@ class Date extends AbstractDataType // Set date format pattern by current locale $localeDateFormat = $this->localeDate->getDateFormat(); $config['options']['dateFormat'] = $localeDateFormat; - $config['outputDateFormat'] = $localeDateFormat; + $config['options']['storeLocale'] = $this->locale; $this->setData('config', $config); parent::prepare(); } diff --git a/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php b/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php index 7a9df1a7df0a42cf40e98b2c7b0f115d78d5301a..e922b1460b3e0727a841ee034cdf62d570dbc628 100644 --- a/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php +++ b/app/code/Magento/Ui/Test/Unit/Component/Form/Element/DataType/DateTest.php @@ -70,9 +70,6 @@ class DateTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('options', $config); $this->assertArrayHasKey('dateFormat', $config['options']); $this->assertEquals($localeDateFormat, $config['options']['dateFormat']); - - $this->assertArrayHasKey('outputDateFormat', $config); - $this->assertEquals($localeDateFormat, $config['outputDateFormat']); } public function testPrepareWithoutTimeOffset() @@ -112,8 +109,6 @@ class DateTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('dateFormat', $config['options']); $this->assertEquals($localeDateFormat, $config['options']['dateFormat']); - $this->assertArrayHasKey('outputDateFormat', $config); - $this->assertEquals($localeDateFormat, $config['outputDateFormat']); } /** @@ -121,6 +116,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testPrepare() { + $this->localeResolverMock->expects($this->any())->method('getLocale')->willReturn('de-DE'); $this->date = $this->objectManagerHelper->getObject( Date::class, [ @@ -133,5 +129,6 @@ class DateTest extends \PHPUnit_Framework_TestCase $this->date->prepare(); $configArray = $this->date->getData('config'); $this->assertEquals('America/Chicago', $configArray['storeTimeZone']); + $this->assertEquals('de-DE', $configArray['options']['storeLocale']); } } diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/date.js b/app/code/Magento/Ui/view/base/web/js/form/element/date.js index fde7faa72ed7c9307e0b2781b7301d421efe2fc0..c9fe97b64a76f6d79a3f4330fb147b7ef9d1a404 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/date.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/date.js @@ -1,5 +1,5 @@ /** - * Copyright © 2015 Magento. All rights reserved. + * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ define([ @@ -53,6 +53,12 @@ define([ pickerDefaultDateFormat: 'MM/dd/y', // ICU Date Format pickerDefaultTimeFormat: 'h:mm a', // ICU Time Format + /** + * Moment compatible format used for moment conversion + * of date from datePicker + */ + momentFormat: 'MM/DD/YYYY', + elementTmpl: 'ui/form/element/date', listens: { @@ -142,7 +148,7 @@ define([ formattedValue = moment(shiftedValue).format('YYYY-MM-DD HH:mm'); value = moment.tz(formattedValue, this.storeTimeZone).tz('UTC').toISOString(); } else { - value = moment(shiftedValue, this.pickerDateTimeFormat); + value = moment(shiftedValue, this.momentFormat); value = value.format(this.outputDateFormat); } } else { @@ -160,6 +166,8 @@ define([ */ prepareDateTimeFormats: function () { this.pickerDateTimeFormat = this.options.dateFormat; + this.momentFormat = this.options.dateFormat ? + this.convertToMomentFormat(this.options.dateFormat) : this.momentFormat; if (this.options.showsTime) { this.pickerDateTimeFormat += ' ' + this.options.timeFormat; @@ -175,6 +183,22 @@ define([ this.outputDateFormat = utils.normalizeDate(this.outputDateFormat); this.validationParams.dateFormat = this.outputDateFormat; + }, + + /** + * Converts PHP IntlFormatter format to moment format. + * + * @param {String} format - PHP format + * @returns {String} - moment compatible formatting + */ + convertToMomentFormat: function (format) { + var newFormat; + + newFormat = format.replace(/yy|y/gi, 'YYYY'); // replace the year + newFormat = newFormat.replace(/dd|d/g, 'DD'); // replace the date + newFormat = newFormat.replace(/mm|m/gi, 'MM'); //replace the month + + return newFormat; } }); }); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js index de6b83eaf2005d06c324c3b7da997b541d305522..0ac9ddc56e00ada18da9842e53791128440150cd 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/date.test.js @@ -6,8 +6,10 @@ /*eslint max-nested-callbacks: 0*/ define([ - 'Magento_Ui/js/form/element/date' -], function (DateElement) { + 'Magento_Ui/js/form/element/date', + 'mageUtils', + 'moment' +], function (DateElement, utils, moment) { 'use strict'; describe('Magento_Ui/js/form/element/date', function () { @@ -19,5 +21,638 @@ define([ }; model = new DateElement(params); }); + + it('Check convertToMomentFormat function', function () { + var format, + momentFormat; + + format = 'M/d/yy'; + momentFormat = 'MM/DD/YYYY'; + expect(model.convertToMomentFormat(format)).toBe(momentFormat); + }); + + it('Check prepareDateTimeFormats function', function () { + spyOn(model, 'convertToMomentFormat'); + spyOn(utils, 'normalizeDate'); + model.prepareDateTimeFormats(); + expect(model.convertToMomentFormat).toHaveBeenCalled(); + expect(utils.normalizeDate).toHaveBeenCalled(); + }); + + it('Check convertToMomentFormat function for all Magento supported locales', function () { + + var fixture, + localeValues, + format, + expectedValue, + momentFormat, + dt, + m, + p; + + fixture = { + 'af_ZA': { + 'locale': 'af_ZA', + 'localeInfo': { + 'format': 'y-MM-dd', + 'expectedValue': '2016-11-17' + } + }, + 'az_Latn_AZ': { + 'locale': 'az_Latn_AZ', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'id_ID': { + 'locale': 'id_ID', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'ms_Latn_MY': { + 'locale': 'ms_Latn_MY', + 'localeInfo': { + 'format': 'd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'bs_Latn_BA': { + 'locale': 'bs_Latn_BA', + 'localeInfo': { + 'format': 'dd.MM.yy.', + 'expectedValue': '17.11.2016.' + } + }, + 'ca_ES': { + 'locale': 'ca_ES', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'cy_GB': { + 'locale': 'cy_GB', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'da_DK': { + 'locale': 'da_DK', + 'localeInfo': { + 'format': 'dd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'de_DE': { + 'locale': 'de_DE', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'de_CH': { + 'locale': 'de_CH', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'de_AT': { + 'locale': 'de_AT', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'et_EE': { + 'locale': 'et_EE', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'en_AU': { + 'locale': 'en_AU', + 'localeInfo': { + 'format': 'd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'en_CA': { + 'locale': 'en_CA', + 'localeInfo': { + 'format': 'y-MM-dd', + 'expectedValue': '2016-11-17' + } + }, + 'en_IE': { + 'locale': 'en_IE', + 'localeInfo': { + 'format': 'dd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'en_NZ': { + 'locale': 'en_NZ', + 'localeInfo': { + 'format': 'd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'en_GB': { + 'locale': 'en_GB', + 'localeInfo': { + 'format': 'dd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'en_US': { + 'locale': 'en_US', + 'localeInfo': { + 'format': 'M/d/yy', + 'expectedValue': '11/17/2016' + } + }, + 'es_AR': { + 'locale': 'es_AR', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'es_CL': { + 'locale': 'es_CL', + 'localeInfo': { + 'format': 'dd-MM-yy', + 'expectedValue': '17-11-2016' + } + }, + 'es_CO': { + 'locale': 'es_CO', + 'localeInfo': { + 'format': 'd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'es_CR': { + 'locale': 'es_CR', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'es_ES': { + 'locale': 'es_ES', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'es_MX': { + 'locale': 'es_MX', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'es_PA': { + 'locale': 'es_PA', + 'localeInfo': { + 'format': 'MM/dd/yy', + 'expectedValue': '11/17/2016' + } + }, + 'es_PE': { + 'locale': 'es_PE', + 'localeInfo': { + 'format': 'd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'es_VE': { + 'locale': 'es_VE', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'eu_ES': { + 'locale': 'eu_ES', + 'localeInfo': { + 'format': 'y/MM/dd', + 'expectedValue': '2016/11/17' + } + }, + 'fil_PH': { + 'locale': 'fil_PH', + 'localeInfo': { + 'format': 'M/d/yy', + 'expectedValue': '11/17/2016' + } + }, + 'fr_BE': { + 'locale': 'fr_BE', + 'localeInfo': { + 'format': 'd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'fr_CA': { + 'locale': 'fr_CA', + 'localeInfo': { + 'format': 'yy-MM-dd', + 'expectedValue': '2016-11-17' + } + }, + 'fr_FR': { + 'locale': 'fr_FR', + 'localeInfo': { + 'format': 'dd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'gl_ES': { + 'locale': 'gl_ES', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'hr_HR': { + 'locale': 'hr_HR', + 'localeInfo': { + 'format': 'dd.MM.y.', + 'expectedValue': '17.11.2016.' + } + }, + 'it_IT': { + 'locale': 'it_IT', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'it_CH': { + 'locale': 'it_CH', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'sw_KE': { + 'locale': 'sw_KE', + 'localeInfo': { + 'format': 'dd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'lv_LV': { + 'locale': 'lv_LV', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'lt_LT': { + 'locale': 'lt_LT', + 'localeInfo': { + 'format': 'y-MM-dd', + 'expectedValue': '2016-11-17' + } + }, + 'hu_HU': { + 'locale': 'hu_HU', + 'localeInfo': { + 'format': 'y. MM. dd.', + 'expectedValue': '2016. 11. 17.' + } + }, + 'nl_BE': { + 'locale': 'nl_BE', + 'localeInfo': { + 'format': 'd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'nl_NL': { + 'locale': 'nl_NL', + 'localeInfo': { + 'format': 'dd-MM-yy', + 'expectedValue': '17-11-2016' + } + }, + 'nb_NO': { + 'locale': 'nb_NO', + 'localeInfo': { + 'format': 'dd.MM.y', + 'expectedValue': '17.11.2016' + } + }, + 'nn_NO': { + 'locale': 'nn_NO', + 'localeInfo': { + 'format': 'dd.MM.y', + 'expectedValue': '17.11.2016' + } + }, + 'pl_PL': { + 'locale': 'pl_PL', + 'localeInfo': { + 'format': 'dd.MM.y', + 'expectedValue': '17.11.2016' + } + }, + 'pt_BR': { + 'locale': 'pt_BR', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'pt_PT': { + 'locale': 'pt_PT', + 'localeInfo': { + 'format': 'dd/MM/yy', + 'expectedValue': '17/11/2016' + } + }, + 'ro_RO': { + 'locale': 'ro_RO', + 'localeInfo': { + 'format': 'dd.MM.y', + 'expectedValue': '17.11.2016' + } + }, + 'sq_AL': { + 'locale': 'sq_AL', + 'localeInfo': { + 'format': 'd.M.yy', + 'expectedValue': '17.11.2016' + } + }, + 'sk_SK': { + 'locale': 'sk_SK', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'sl_SI': { + 'locale': 'sl_SI', + 'localeInfo': { + 'format': 'd. MM. yy', + 'expectedValue': '17. 11. 2016' + } + }, + 'fi_FI': { + 'locale': 'fi_FI', + 'localeInfo': { + 'format': 'd.M.y', + 'expectedValue': '17.11.2016' + } + }, + 'sv_SE': { + 'locale': 'sv_SE', + 'localeInfo': { + 'format': 'y-MM-dd', + 'expectedValue': '2016-11-17' + } + }, + 'vi_VN': { + 'locale': 'vi_VN', + 'localeInfo': { + 'format': 'dd/MM/y', + 'expectedValue': '17/11/2016' + } + }, + 'tr_TR': { + 'locale': 'tr_TR', + 'localeInfo': { + 'format': 'd.MM.y', + 'expectedValue': '17.11.2016' + } + }, + 'is_IS': { + 'locale': 'is_IS', + 'localeInfo': { + 'format': 'd.M.y', + 'expectedValue': '17.11.2016' + } + }, + 'cs_CZ': { + 'locale': 'cs_CZ', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'el_GR': { + 'locale': 'el_GR', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'be_BY': { + 'locale': 'be_BY', + 'localeInfo': { + 'format': 'd.M.yy', + 'expectedValue': '17.11.2016' + } + }, + 'bg_BG': { + 'locale': 'bg_BG', + 'localeInfo': { + 'format': 'd.MM.yy г.', + 'expectedValue': '17.11.2016 г.' + } + }, + 'mk_MK': { + 'locale': 'mk_MK', + 'localeInfo': { + 'format': 'dd.M.yy', + 'expectedValue': '17.11.2016' + } + }, + 'mn_Cyrl_MN': { + 'locale': 'mn_Cyrl_MN', + 'localeInfo': { + 'format': 'y-MM-dd', + 'expectedValue': '2016-11-17' + } + }, + 'ru_RU': { + 'locale': 'ru_RU', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'sr_Cyrl_RS': { + 'locale': 'sr_Cyrl_RS', + 'localeInfo': { + 'format': 'd.M.yy.', + 'expectedValue': '17.11.2016.' + } + }, + 'uk_UA': { + 'locale': 'uk_UA', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'he_IL': { + 'locale': 'he_IL', + 'localeInfo': { + 'format': 'd.M.y', + 'expectedValue': '17.11.2016' + } + }, + 'ar_DZ': { + 'locale': 'ar_DZ', + 'localeInfo': { + 'format': 'dâ€/Mâ€/y', + 'expectedValue': '17â€/11â€/2016' + } + }, + 'ar_KW': { + 'locale': 'ar_KW', + 'localeInfo': { + 'format': 'dâ€/Mâ€/y', + 'expectedValue': '17â€/11â€/2016' + } + }, + 'ar_MA': { + 'locale': 'ar_MA', + 'localeInfo': { + 'format': 'dâ€/Mâ€/y', + 'expectedValue': '17â€/11â€/2016' + } + }, + 'ar_SA': { + 'locale': 'ar_SA', + 'localeInfo': { + 'format': 'dâ€/Mâ€/y', + 'expectedValue': '17â€/11â€/2016' + } + }, + 'ar_EG': { + 'locale': 'ar_EG', + 'localeInfo': { + 'format': 'dâ€/Mâ€/y', + 'expectedValue': '17â€/11â€/2016' + } + }, + 'fa_IR': { + 'locale': 'fa_IR', + 'localeInfo': { + 'format': 'y/M/d G', + 'expectedValue': '2016/11/17 G' + } + }, + 'hi_IN': { + 'locale': 'hi_IN', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'bn_BD': { + 'locale': 'bn_BD', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'gu_IN': { + 'locale': 'gu_IN', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'th_TH': { + 'locale': 'th_TH', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'lo_LA': { + 'locale': 'lo_LA', + 'localeInfo': { + 'format': 'd/M/y', + 'expectedValue': '17/11/2016' + } + }, + 'ka_GE': { + 'locale': 'ka_GE', + 'localeInfo': { + 'format': 'dd.MM.yy', + 'expectedValue': '17.11.2016' + } + }, + 'km_KH': { + 'locale': 'km_KH', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'zh_Hans_CN': { + 'locale': 'zh_Hans_CN', + 'localeInfo': { + 'format': 'yy/M/d', + 'expectedValue': '2016/11/17' + } + }, + 'zh_Hant_HK': { + 'locale': 'zh_Hant_HK', + 'localeInfo': { + 'format': 'd/M/yy', + 'expectedValue': '17/11/2016' + } + }, + 'zh_Hant_TW': { + 'locale': 'zh_Hant_TW', + 'localeInfo': { + 'format': 'y/M/d', + 'expectedValue': '2016/11/17' + } + }, + 'ja_JP': { + 'locale': 'ja_JP', + 'localeInfo': { + 'format': 'y/MM/dd', + 'expectedValue': '2016/11/17' + } + }, + 'ko_KR': { + 'locale': 'ko_KR', + 'localeInfo': { + 'format': 'yy. M. d.', + 'expectedValue': '2016. 11. 17.' + } + } + }; + + for (p in fixture) { + if (fixture.hasOwnProperty(p)) { + localeValues = fixture[p]; + format = localeValues.localeInfo.format; + expectedValue = localeValues.localeInfo.expectedValue; + momentFormat = model.convertToMomentFormat(format); + dt = moment('2016-11-17'); + m = moment(dt, momentFormat); + + expect(m.format(momentFormat)).toBe(expectedValue); + } + } + }); }); }); diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt index 29b5280ec6693f70c8d65a1f40e25c644897ace1..4f27497305353e0903207a48ed81d22885e66120 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt @@ -923,7 +923,6 @@ vendor/magento/module-ui/view/base/web/js/form/components/html.js vendor/magento/module-ui/view/base/web/js/form/components/tab_group.js vendor/magento/module-ui/view/base/web/js/form/components/tab.js vendor/magento/module-ui/view/base/web/js/form/element/abstract.js -vendor/magento/module-ui/view/base/web/js/form/element/date.js vendor/magento/module-ui/view/base/web/js/form/element/helpers/options.js vendor/magento/module-ui/view/base/web/js/form/element/multiselect.js vendor/magento/module-ui/view/base/web/js/form/element/post-code.js diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index 35d7b3ac5ee20ae669ccc66775498b3c0d9348b4..e2ea747218f60485e644ba6c3ba9b65da68409ab 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -27,8 +27,7 @@ class Curl implements \Zend_Http_Client_Adapter_Interface | CURLPROTO_FTPS ), 'verifypeer' => true, - 'verifyhost' => 2, - 'sslversion' => 6 + 'verifyhost' => 2 ]; /** diff --git a/lib/internal/Magento/Framework/HTTP/Client/Curl.php b/lib/internal/Magento/Framework/HTTP/Client/Curl.php index 5ebc92abf70d9063af63683f5f530dd01470865a..c1d1299a1bd3fd578d1a40c2f173682dc079f004 100644 --- a/lib/internal/Magento/Framework/HTTP/Client/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Client/Curl.php @@ -13,8 +13,6 @@ namespace Magento\Framework\HTTP\Client; */ class Curl implements \Magento\Framework\HTTP\ClientInterface { - const SSL_VERSION = 6; - /** * Max supported protocol by curl CURL_SSLVERSION_TLSv1_2 * @var int @@ -122,7 +120,7 @@ class Curl implements \Magento\Framework\HTTP\ClientInterface /** * @param int|null $sslVersion */ - public function __construct($sslVersion = self::SSL_VERSION) + public function __construct($sslVersion = null) { $this->sslVersion = $sslVersion; } @@ -383,7 +381,9 @@ class Curl implements \Magento\Framework\HTTP\ClientInterface $this->curlOption(CURLOPT_RETURNTRANSFER, 1); $this->curlOption(CURLOPT_HEADERFUNCTION, [$this, 'parseHeaders']); - $this->curlOption(CURLOPT_SSLVERSION, $this->sslVersion); + if ($this->sslVersion !== null) { + $this->curlOption(CURLOPT_SSLVERSION, $this->sslVersion); + } if (count($this->_curlUserOptions)) { foreach ($this->_curlUserOptions as $k => $v) {