diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index 4b0eceae2e116..b32bdff510eab 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -257,6 +257,7 @@ public function _exportIterateCollection($callback, array $args) $break = false; while ($break !== true) { + $originalCollection->clear(); $originalCollection->setPageSize($this->getExportPageSize()); $originalCollection->setCurPage($page); $originalCollection->load(); diff --git a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php index 7380ffe0e271a..c875da549e8ef 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php @@ -112,7 +112,7 @@ public function testSetCookiePathNonDefault() public function testSetSessionSettingsByConstructor($secureRequest) { $sessionName = 'admin'; - $this->requestMock->expects($this->once())->method('isSecure')->willReturn($secureRequest); + $this->requestMock->expects($this->exactly(2))->method('isSecure')->willReturn($secureRequest); $validatorMock = $this->getMockBuilder('Magento\Framework\Validator\ValidatorInterface') ->disableOriginalConstructor() diff --git a/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php b/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php index fc577973edfb1..bfb3f619ae36d 100644 --- a/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php +++ b/app/code/Magento/Customer/Api/CustomerRepositoryInterface.php @@ -13,7 +13,7 @@ interface CustomerRepositoryInterface { /** - * Create customer. + * Create or update a customer. * * @api * @param \Magento\Customer\Api\Data\CustomerInterface $customer @@ -38,7 +38,7 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa public function get($email, $websiteId = null); /** - * Retrieve customer. + * Get customer by customer ID. * * @api * @param int $customerId @@ -51,6 +51,10 @@ public function getById($customerId); /** * Retrieve customers which match a specified criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CustomerRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * * @api * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Customer\Api\Data\CustomerSearchResultsInterface diff --git a/app/code/Magento/Customer/Api/GroupRepositoryInterface.php b/app/code/Magento/Customer/Api/GroupRepositoryInterface.php index 1ba4a0546989a..67b4b42128534 100644 --- a/app/code/Magento/Customer/Api/GroupRepositoryInterface.php +++ b/app/code/Magento/Customer/Api/GroupRepositoryInterface.php @@ -41,6 +41,10 @@ public function getById($id); * The list of groups can be filtered to exclude the NOT_LOGGED_IN group using the first parameter and/or it can * be filtered by tax class. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#GroupRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * * @api * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Customer\Api\Data\GroupSearchResultsInterface diff --git a/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php b/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php index c618baa701525..a2137e9bd6c63 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php +++ b/app/code/Magento/Directory/Model/Currency/Import/FixerIo.php @@ -80,8 +80,11 @@ private function convertBatch($data, $currencyFrom, $currenciesTo) $url = str_replace('{{CURRENCY_TO}}', $currenciesStr, $url); set_time_limit(0); - $response = $this->getServiceResponse($url); - ini_restore('max_execution_time'); + try { + $response = $this->getServiceResponse($url); + } finally { + ini_restore('max_execution_time'); + } foreach ($currenciesTo as $currencyTo) { if ($currencyFrom == $currencyTo) { diff --git a/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php b/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php index 107743d4ad04c..f8f0dcd021e07 100644 --- a/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php +++ b/app/code/Magento/Directory/Model/Currency/Import/Webservicex.php @@ -72,7 +72,7 @@ protected function _convert($currencyFrom, $currencyTo, $retry = 0) )->getBody(); $xml = simplexml_load_string($response, null, LIBXML_NOERROR); - if (!$xml) { + if (!$xml || (isset($xml[0]) && $xml[0] == -1)) { $this->_messages[] = __('We can\'t retrieve a rate from %1.', $url); return null; } diff --git a/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php new file mode 100644 index 0000000000000..f2270ef20e61d --- /dev/null +++ b/app/code/Magento/Directory/Model/Currency/Import/YahooFinance.php @@ -0,0 +1,183 @@ +scopeConfig = $scopeConfig; + $this->httpClientFactory = $httpClientFactory; + } + + /** + * {@inheritdoc} + */ + public function fetchRates() + { + $data = []; + $currencies = $this->_getCurrencyCodes(); + $defaultCurrencies = $this->_getDefaultCurrencyCodes(); + + foreach ($defaultCurrencies as $currencyFrom) { + if (!isset($data[$currencyFrom])) { + $data[$currencyFrom] = []; + } + $data = $this->convertBatch($data, $currencyFrom, $currencies); + ksort($data[$currencyFrom]); + } + return $data; + } + + /** + * Return currencies convert rates in batch mode + * + * @param array $data + * @param string $currencyFrom + * @param array $currenciesTo + * @return array + */ + private function convertBatch($data, $currencyFrom, $currenciesTo) + { + $url = $this->buildUrl($currencyFrom, $currenciesTo); + set_time_limit(0); + try { + $response = $this->getServiceResponse($url); + } finally { + ini_restore('max_execution_time'); + } + + foreach ($currenciesTo as $currencyTo) { + if ($currencyFrom == $currencyTo) { + $data[$currencyFrom][$currencyTo] = $this->_numberFormat(1); + } else { + if (empty($response[$currencyFrom . $currencyTo])) { + $this->_messages[] = __('We can\'t retrieve a rate from %1 for %2.', $url, $currencyTo); + $data[$currencyFrom][$currencyTo] = null; + } else { + $data[$currencyFrom][$currencyTo] = $this->_numberFormat( + (double)$response[$currencyFrom . $currencyTo] + ); + } + } + } + return $data; + } + + /** + * Get Fixer.io service response + * + * @param string $url + * @param int $retry + * @return array + */ + private function getServiceResponse($url, $retry = 0) + { + /** @var \Magento\Framework\HTTP\ZendClient $httpClient */ + $httpClient = $this->httpClientFactory->create(); + $response = []; + try { + $jsonResponse = $httpClient->setUri( + $url + )->setConfig( + [ + 'timeout' => $this->scopeConfig->getValue( + $this->timeoutConfigPath, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ), + ] + )->request( + 'GET' + )->getBody(); + + $jsonResponse = json_decode($jsonResponse, true); + if (!empty($jsonResponse['query']['results']['rate'])) { + $response = array_column($jsonResponse['query']['results']['rate'], 'Rate', 'id'); + } + } catch (\Exception $e) { + if ($retry == 0) { + $response = $this->getServiceResponse($url, 1); + } + } + return $response; + } + + /** + * {@inheritdoc} + */ + protected function _convert($currencyFrom, $currencyTo) + { + } + + /** + * Build url for Currency Service + * + * @param string $currencyFrom + * @param string[] $currenciesTo + * @return string + */ + private function buildUrl($currencyFrom, $currenciesTo) + { + $query = urlencode('select ') . '*' . urlencode(' from yahoo.finance.xchange where pair in ('); + $query .= + urlencode( + implode( + ',', + array_map( + function ($currencyTo) use ($currencyFrom) { + return '"' . $currencyFrom . $currencyTo . '"'; + }, + $currenciesTo + ) + ) + ); + $query .= ')'; + return str_replace('{{YQL_STRING}}', $query, $this->currencyConverterUrl); + } +} diff --git a/app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php b/app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php new file mode 100644 index 0000000000000..4add2ca82d19b --- /dev/null +++ b/app/code/Magento/Directory/Test/Unit/Model/Currency/Import/YahooFinanceTest.php @@ -0,0 +1,94 @@ +currencyFactoryMock = $this->getMockBuilder('Magento\Directory\Model\CurrencyFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->httpClientFactoryMock = $this->getMockBuilder('Magento\Framework\HTTP\ZendClientFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $scopeMock = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + + $this->model = $objectManagerHelper->getObject( + 'Magento\Directory\Model\Currency\Import\YahooFinance', + [ + 'currencyFactory' => $this->currencyFactoryMock, + 'scopeConfig' => $scopeMock, + 'httpClientFactory' => $this->httpClientFactoryMock + ] + ); + } + + public function testFetchRates() + { + $currencyFromList = ['USD']; + $currencyToList = ['EUR', 'UAH']; + $responseBody = '{"query":{"count":7,"created":"2016-04-05T16:46:55Z","lang":"en-US","results":{"rate":' + . '[{"id":"USDEUR","Name":"USD/EUR","Rate":"0.9022","Date":"4/5/2016"}]}}}'; + $expectedCurrencyRateList = ['USD' => ['EUR' => 0.9022, 'UAH' => null]]; + $message = "We can't retrieve a rate from http://query.yahooapis.com/v1/public/yql?format=json" + . "&q=select+*+from+yahoo.finance.xchange+where+pair+in+%28%22USDEUR%22%2C%22USDUAH%22)" + . "&env=store://datatables.org/alltableswithkeys for UAH."; + + /** @var \Magento\Directory\Model\Currency|\PHPUnit_Framework_MockObject_MockObject $currencyMock */ + $currencyMock = $this->getMockBuilder('Magento\Directory\Model\Currency') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + /** @var \Magento\Framework\HTTP\ZendClient|\PHPUnit_Framework_MockObject_MockObject $currencyMock */ + $httpClientMock = $this->getMockBuilder('Magento\Framework\HTTP\ZendClient') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + /** @var \Zend_Http_Response|\PHPUnit_Framework_MockObject_MockObject $currencyMock */ + $httpResponseMock = $this->getMockBuilder('Zend_Http_Response') + ->disableOriginalConstructor() + ->setMethods([]) + ->getMock(); + $this->currencyFactoryMock->expects($this->any())->method('create')->willReturn($currencyMock); + $currencyMock->expects($this->once())->method('getConfigBaseCurrencies')->willReturn($currencyFromList); + $currencyMock->expects($this->once())->method('getConfigAllowCurrencies')->willReturn($currencyToList); + $this->httpClientFactoryMock->expects($this->any())->method('create')->willReturn($httpClientMock); + $httpClientMock->expects($this->atLeastOnce())->method('setUri')->willReturnSelf(); + $httpClientMock->expects($this->atLeastOnce())->method('setConfig')->willReturnSelf(); + $httpClientMock->expects($this->atLeastOnce())->method('request')->willReturn($httpResponseMock); + $httpResponseMock->expects($this->any())->method('getBody')->willReturn($responseBody); + + $this->assertEquals($expectedCurrencyRateList, $this->model->fetchRates()); + $messages = $this->model->getMessages(); + $this->assertNotEmpty($messages); + $this->assertTrue(is_array($messages)); + $this->assertEquals($message, (string)$messages[0]); + } +} diff --git a/app/code/Magento/Directory/etc/adminhtml/system.xml b/app/code/Magento/Directory/etc/adminhtml/system.xml index aacef0d8ff6e1..dc56a23d20280 100644 --- a/app/code/Magento/Directory/etc/adminhtml/system.xml +++ b/app/code/Magento/Directory/etc/adminhtml/system.xml @@ -34,6 +34,18 @@ 1 + + + + + + + + + + + + diff --git a/app/code/Magento/Directory/etc/config.xml b/app/code/Magento/Directory/etc/config.xml index 8bb69e52687d2..5c4de023286c8 100644 --- a/app/code/Magento/Directory/etc/config.xml +++ b/app/code/Magento/Directory/etc/config.xml @@ -18,6 +18,12 @@ USD USD + + 100 + + + 100 + 100 diff --git a/app/code/Magento/Directory/etc/di.xml b/app/code/Magento/Directory/etc/di.xml index 724a7fcce1b9c..f868197e60593 100644 --- a/app/code/Magento/Directory/etc/di.xml +++ b/app/code/Magento/Directory/etc/di.xml @@ -9,6 +9,10 @@ + + Yahoo Finance Exchange + Magento\Directory\Model\Currency\Import\YahooFinance + Webservicex Magento\Directory\Model\Currency\Import\Webservicex diff --git a/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php b/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php index 4529920024b83..6c5e9d4ad2de8 100644 --- a/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php +++ b/app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php @@ -15,6 +15,10 @@ interface AttributeSetRepositoryInterface /** * Retrieve list of Attribute Sets * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#AttributeSetRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Eav\Api\Data\AttributeSetSearchResultsInterface */ diff --git a/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php b/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php new file mode 100644 index 0000000000000..742716cb36d08 --- /dev/null +++ b/app/code/Magento/Email/Model/Plugin/WindowsSmtpConfig.php @@ -0,0 +1,59 @@ +config = $config; + $this->osInfo = $osInfo; + } + + /** + * To configure smtp settings for session right before sending message on windows server + * + * @param \Magento\Framework\Mail\TransportInterface $subject + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject) + { + if ($this->osInfo->isWindows()) { + ini_set('SMTP', $this->config->getValue(self::XML_SMTP_HOST)); + ini_set('smtp_port', $this->config->getValue(self::XML_SMTP_PORT)); + } + } +} diff --git a/app/code/Magento/Email/etc/di.xml b/app/code/Magento/Email/etc/di.xml index 494d32a6557b1..5be5efeb0b678 100644 --- a/app/code/Magento/Email/etc/di.xml +++ b/app/code/Magento/Email/etc/di.xml @@ -57,4 +57,7 @@ + + + diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 48ba5e8918d29..53da1abcca982 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -10,6 +10,7 @@ * * @method int getCustomerId() * @method Session setCustomerId() + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Session extends \Magento\Framework\Model\AbstractModel { @@ -94,6 +95,13 @@ class Session extends \Magento\Framework\Model\AbstractModel */ protected $sessionConfig; + /** + * Request + * + * @var \Magento\Framework\App\Request\Http + */ + private $request; + /** * Constructor * @@ -379,6 +387,7 @@ private function setCookie($value, $duration, $path) $publicCookieMetadata = $this->_cookieMetadataFactory->createPublicCookieMetadata() ->setDuration($duration) ->setPath($path) + ->setSecure($this->getRequest()->isSecure()) ->setHttpOnly(true); $this->_cookieManager->setPublicCookie( self::COOKIE_NAME, @@ -386,4 +395,19 @@ private function setCookie($value, $duration, $path) $publicCookieMetadata ); } + + /** + * Get request object + * + * @return \Magento\Framework\App\Request\Http + * @deprecated + */ + private function getRequest() + { + if ($this->request == null) { + $this->request = \Magento\Framework\App\ObjectManager::getInstance() + ->get('\Magento\Framework\App\Request\Http'); + } + return $this->request; + } } diff --git a/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php b/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php index 1cb59428f709f..5f99301ac4864 100644 --- a/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php +++ b/app/code/Magento/Persistent/Test/Unit/Model/SessionTest.php @@ -70,6 +70,7 @@ protected function setUp() 'cookieManager' => $this->cookieManagerMock, 'context' => $context, 'cookieMetadataFactory' => $this->cookieMetadataFactoryMock, + 'request' => $this->getMock('\Magento\Framework\App\Request\Http', [], [], '', false, false), 'resource' => $resourceMock, ] ); @@ -129,6 +130,10 @@ public function testSetPersistentCookie() ->method('setDuration') ->with($duration) ->will($this->returnSelf()); + $cookieMetadataMock->expects($this->once()) + ->method('setSecure') + ->with(false) + ->will($this->returnSelf()); $cookieMetadataMock->expects($this->once()) ->method('setHttpOnly') ->with(true) @@ -172,6 +177,10 @@ public function testRenewPersistentCookie( ->method('setDuration') ->with($cookieDuration) ->will($this->returnSelf()); + $cookieMetadataMock->expects($this->exactly($numCalls)) + ->method('setSecure') + ->with(false) + ->will($this->returnSelf()); $cookieMetadataMock->expects($this->exactly($numCalls)) ->method('setHttpOnly') ->with(true) diff --git a/app/code/Magento/Quote/Api/CartRepositoryInterface.php b/app/code/Magento/Quote/Api/CartRepositoryInterface.php index 2244e4505eb3c..a8ef3dfba7690 100644 --- a/app/code/Magento/Quote/Api/CartRepositoryInterface.php +++ b/app/code/Magento/Quote/Api/CartRepositoryInterface.php @@ -23,6 +23,11 @@ public function get($cartId); /** * Enables administrative users to list carts that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CartRepositoryInterface to determine + * which call to use to get detailed information about all attributes for an object. + * + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Quote\Api\Data\CartSearchResultsInterface */ diff --git a/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php b/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php index 493e455246ce9..9566cdaf6fe62 100644 --- a/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/GuestPaymentMethodManagementInterface.php @@ -35,6 +35,10 @@ public function get($cartId); /** * List available payment methods for a specified shopping cart. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#GuestPaymentMethodManagementInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param string $cartId The cart ID. * @return \Magento\Quote\Api\Data\PaymentMethodInterface[] Array of payment methods. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist. diff --git a/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php b/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php index 49f143ae21734..f836a42be1fcf 100644 --- a/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php +++ b/app/code/Magento/Quote/Api/PaymentMethodManagementInterface.php @@ -35,6 +35,10 @@ public function get($cartId); /** * Lists available payment methods for a specified shopping cart. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#PaymentMethodManagementInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param int $cartId The cart ID. * @return \Magento\Quote\Api\Data\PaymentMethodInterface[] Array of payment methods. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist. diff --git a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php index 30b8d3e14538c..e922ca104daea 100644 --- a/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php @@ -18,6 +18,10 @@ interface CreditmemoRepositoryInterface /** * Lists credit memos that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CreditmemoRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\CreditmemoSearchResultInterface Credit memo search result interface. */ diff --git a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php index 1670de1230289..b2250a1c9b6e2 100644 --- a/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/InvoiceRepositoryInterface.php @@ -16,6 +16,10 @@ interface InvoiceRepositoryInterface /** * Lists invoices that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#InvoiceRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\InvoiceSearchResultInterface Invoice search result interface. */ diff --git a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php index b1eb49e9fe429..dde41bda84bb5 100644 --- a/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php @@ -18,6 +18,10 @@ interface OrderItemRepositoryInterface /** * Lists order items that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#OrderItemRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderItemSearchResultInterface Order item search result interface. */ diff --git a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php index 867b8d21318f8..15b616986c666 100644 --- a/app/code/Magento/Sales/Api/OrderRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/OrderRepositoryInterface.php @@ -18,6 +18,10 @@ interface OrderRepositoryInterface /** * Lists orders that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#OrderRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\OrderSearchResultInterface Order search result interface. */ diff --git a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php index d9e49ab9286de..8ca32a107df6c 100644 --- a/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php @@ -17,6 +17,10 @@ interface ShipmentRepositoryInterface /** * Lists shipments that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#ShipmentRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\ShipmentSearchResultInterface Shipment search results interface. */ diff --git a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php index bdf8d27ca6d16..1d100f9f75082 100644 --- a/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php +++ b/app/code/Magento/Sales/Api/TransactionRepositoryInterface.php @@ -16,6 +16,10 @@ interface TransactionRepositoryInterface /** * Lists transactions that match specified search criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TransactionRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria The search criteria. * @return \Magento\Sales\Api\Data\TransactionSearchResultInterface Transaction search result interface. */ diff --git a/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php b/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php index c06a75d1ec652..b1f7108e1dc48 100644 --- a/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php +++ b/app/code/Magento/SalesRule/Api/CouponRepositoryInterface.php @@ -13,7 +13,7 @@ interface CouponRepositoryInterface { /** - * Save coupon. + * Save a coupon. * * @param \Magento\SalesRule\Api\Data\CouponInterface $coupon * @return \Magento\SalesRule\Api\Data\CouponInterface @@ -34,7 +34,11 @@ public function save(\Magento\SalesRule\Api\Data\CouponInterface $coupon); public function getById($couponId); /** - * Retrieve coupon. + * Retrieve a coupon using the specified search criteria. + * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#CouponRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\SalesRule\Api\Data\CouponSearchResultInterface diff --git a/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php b/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php index 5e29813f8fe78..d45b163d5d834 100644 --- a/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php +++ b/app/code/Magento/SalesRule/Api/RuleRepositoryInterface.php @@ -34,7 +34,11 @@ public function save(\Magento\SalesRule\Api\Data\RuleInterface $rule); public function getById($ruleId); /** - * Retrieve sales rules. + * Retrieve sales rules that match te specified criteria. + * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#RuleRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\SalesRule\Api\Data\RuleSearchResultInterface diff --git a/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php b/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php index bdbd968635880..af08e14325e94 100644 --- a/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php +++ b/app/code/Magento/Tax/Api/TaxClassRepositoryInterface.php @@ -25,6 +25,10 @@ public function get($taxClassId); /** * Retrieve tax classes which match a specific criteria. * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TaxClassRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Tax\Api\Data\TaxClassSearchResultsInterface containing Data\TaxClassInterface * @throws \Magento\Framework\Exception\InputException diff --git a/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php b/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php index 88ec624cdbdd3..b4fa0d9ef64fd 100644 --- a/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php +++ b/app/code/Magento/Tax/Api/TaxRateRepositoryInterface.php @@ -45,6 +45,10 @@ public function deleteById($rateId); /** * Search TaxRates * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TaxRateRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\Tax\Api\Data\TaxRateSearchResultsInterface containing Data\TaxRateInterface objects * @throws \Magento\Framework\Exception\InputException If there is a problem with the input diff --git a/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php b/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php index 29ff3d423e17b..5f477f33bae2e 100644 --- a/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php +++ b/app/code/Magento/Tax/Api/TaxRuleRepositoryInterface.php @@ -53,6 +53,10 @@ public function deleteById($ruleId); /** * Search TaxRules * + * This call returns an array of objects, but detailed information about each object’s attributes might not be + * included. See http://devdocs.magento.com/codelinks/attributes.html#TaxRuleRepositoryInterface to + * determine which call to use to get detailed information about all attributes for an object. + * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Tax\Api\Data\TaxRuleSearchResultsInterface containing TaxRuleInterface objects * @throws \Magento\Framework\Exception\InputException If there is a problem with the input diff --git a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php index 7b03f1c864069..e33badff9a638 100644 --- a/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php +++ b/lib/internal/Magento/Framework/App/Helper/AbstractHelper.php @@ -73,6 +73,11 @@ abstract class AbstractHelper */ protected $scopeConfig; + /** + * @var \Magento\Framework\Cache\ConfigInterface + */ + protected $_cacheConfig; + /** * @param Context $context */ diff --git a/lib/internal/Magento/Framework/App/PageCache/Version.php b/lib/internal/Magento/Framework/App/PageCache/Version.php index 6f15cbc70e0a6..272ad8ce5c02f 100644 --- a/lib/internal/Magento/Framework/App/PageCache/Version.php +++ b/lib/internal/Magento/Framework/App/PageCache/Version.php @@ -79,6 +79,7 @@ public function process() $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata() ->setDuration(self::COOKIE_PERIOD) ->setPath('/') + ->setSecure($this->request->isSecure()) ->setHttpOnly(false); $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php index 22d6f910b8287..b1e8748c3ec8f 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/PageCache/VersionTest.php @@ -88,6 +88,11 @@ public function testProcess($isPost) ->with(Version::COOKIE_PERIOD) ->will($this->returnSelf()); + $publicCookieMetadataMock->expects($this->once()) + ->method('setSecure') + ->with(false) + ->will($this->returnSelf()); + $publicCookieMetadataMock->expects($this->once()) ->method('setHttpOnly') ->with(false) diff --git a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php index 97439e1bd728b..30bed420be66c 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/Sftp.php @@ -239,7 +239,7 @@ public function ls($grep = null) $currentWorkingDir = $this->pwd(); $result = []; foreach ($list as $name) { - $result[] = ['text' => $name, 'id' => "{$currentWorkingDir}{$name}"]; + $result[] = ['text' => $name, 'id' => "{$currentWorkingDir}/{$name}"]; } return $result; } diff --git a/lib/internal/Magento/Framework/Session/Config.php b/lib/internal/Magento/Framework/Session/Config.php index 4b6517ab807d0..b85a4185a9edc 100644 --- a/lib/internal/Magento/Framework/Session/Config.php +++ b/lib/internal/Magento/Framework/Session/Config.php @@ -144,6 +144,11 @@ public function __construct( $this->setCookieHttpOnly( $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_HTTPONLY, $this->_scopeType) ); + + $secureURL = $this->_scopeConfig->getValue('web/secure/base_url', $this->_scopeType); + $unsecureURL = $this->_scopeConfig->getValue('web/unsecure/base_url', $this->_scopeType); + $isFullySecuredURL = $secureURL == $unsecureURL; + $this->setCookieSecure($isFullySecuredURL && $this->_httpRequest->isSecure()); } /** diff --git a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php index 4016a2831ac0f..fbaa87d431df6 100644 --- a/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Session/Test/Unit/ConfigTest.php @@ -354,6 +354,7 @@ public function constructorDataProvider() 'session.cookie_path' => '/', 'session.cookie_domain' => 'init.host', 'session.cookie_httponly' => false, + 'session.cookie_secure' => false, ], ], 'all invalid' => [ @@ -362,6 +363,7 @@ public function constructorDataProvider() [ 'session.cache_limiter' => 'files', 'session.cookie_httponly' => false, + 'session.cookie_secure' => false, ], ], 'invalid_valid' => [ @@ -373,6 +375,7 @@ public function constructorDataProvider() 'session.cookie_path' => '/', 'session.cookie_domain' => 'init.host', 'session.cookie_httponly' => false, + 'session.cookie_secure' => false, ], ], ]; diff --git a/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php b/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php index 64c21db08bb5a..dccceb70cdc48 100644 --- a/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php +++ b/lib/internal/Magento/Framework/Shell/CommandRendererBackground.php @@ -32,8 +32,9 @@ public function __construct(OsInfo $osInfo) public function render($command, array $arguments = []) { $command = parent::render($command, $arguments); + return $this->osInfo->isWindows() ? 'start /B "magento background task" ' . $command - : $command . ' > /dev/null &'; + : str_replace('2>&1', '> /dev/null &', $command); } } diff --git a/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php b/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php index bac1f118035eb..b40394c853637 100644 --- a/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php +++ b/lib/internal/Magento/Framework/Shell/Test/Unit/CommandRendererBackgroundTest.php @@ -53,7 +53,7 @@ public function commandPerOsTypeDataProvider() { return [ 'windows' => [true, 'start /B "magento background task" ' . $this->testCommand . ' 2>&1'], - 'unix' => [false, $this->testCommand . ' 2>&1 > /dev/null &'], + 'unix' => [false, $this->testCommand . ' > /dev/null &'], ]; } }