Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #4488 from magento-techdivision/php73_update
Browse files Browse the repository at this point in the history
[Techdivision] Add PHP 7.3 support
  • Loading branch information
danielrenaud authored Jul 30, 2019
2 parents 65cdb4c + 23bd6d3 commit fc7fb0d
Show file tree
Hide file tree
Showing 235 changed files with 1,105 additions and 725 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"lib-libxml": "*",
"magento/framework": "*",
"magento/module-backend": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedPricingImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-catalog-import-export": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedSearch/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"magento/module-customer": "*",
"magento/module-search": "*",
"magento/module-store": "*",
"php": "~7.1.3||~7.2.0"
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
"license": [
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Amqp/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"magento/framework": "*",
"magento/framework-amqp": "*",
"magento/framework-message-queue": "*",
"php": "~7.1.3||~7.2.0"
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
"license": [
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AmqpStore/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"magento/framework": "*",
"magento/framework-amqp": "*",
"magento/module-store": "*",
"php": "~7.1.3||~7.2.0"
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"suggest": {
"magento/module-asynchronous-operations": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public function __construct(ConverterInterface $converter, array $responseHandle
}

/**
* @param \Zend_Http_Response $response
* Get result from $response.
*
* @param \Zend_Http_Response $response
* @return bool|string
*/
public function getResult(\Zend_Http_Response $response)
Expand All @@ -41,7 +42,8 @@ public function getResult(\Zend_Http_Response $response)
$converterMediaType = $this->converter->getContentMediaType();

/** Content-Type header may not only contain media-type declaration */
if ($response->getBody() && is_int(strripos($response->getHeader('Content-Type'), $converterMediaType))) {
if ($response->getBody()
&& is_int(strripos($response->getHeader('Content-Type'), (string) $converterMediaType))) {
$responseBody = $this->converter->fromBody($response->getBody());
} else {
$responseBody = [];
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-analytics",
"description": "N/A",
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/module-backend": "*",
"magento/module-config": "*",
"magento/module-integration": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AsynchronousOperations/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"magento/module-authorization": "*",
"magento/module-backend": "*",
"magento/module-ui": "*",
"php": "~7.1.3||~7.2.0"
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"suggest": {
"magento/module-admin-notification": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorization/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-backend": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AuthorizenetAcceptjs/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-payment": "*",
"magento/module-sales": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AuthorizenetCardinal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/module-authorizenet-acceptjs": "*",
"magento/framework": "*",
"magento/module-cardinal-commerce": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AuthorizenetGraphQl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-quote-graph-ql": "*"
},
Expand Down
35 changes: 29 additions & 6 deletions app/code/Magento/Backend/App/Area/FrontNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
use Magento\Backend\Setup\ConfigOptionsList;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\RequestInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\Store;
use Zend\Uri\Uri;

/**
* Class to get area front name.
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -59,19 +64,35 @@ class FrontNameResolver implements \Magento\Framework\App\Area\FrontNameResolver
*/
private $scopeConfig;

/**
* @var Uri
*/
private $uri;

/**
* @var RequestInterface
*/
private $request;

/**
* @param \Magento\Backend\App\Config $config
* @param DeploymentConfig $deploymentConfig
* @param ScopeConfigInterface $scopeConfig
* @param Uri $uri
* @param RequestInterface $request
*/
public function __construct(
\Magento\Backend\App\Config $config,
DeploymentConfig $deploymentConfig,
ScopeConfigInterface $scopeConfig
ScopeConfigInterface $scopeConfig,
Uri $uri = null,
RequestInterface $request = null
) {
$this->config = $config;
$this->defaultFrontName = $deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_BACKEND_FRONTNAME);
$this->scopeConfig = $scopeConfig;
$this->uri = $uri ?: ObjectManager::getInstance()->get(Uri::class);
$this->request = $request ?: ObjectManager::getInstance()->get(RequestInterface::class);
}

/**
Expand Down Expand Up @@ -104,8 +125,8 @@ public function isHostBackend()
} else {
$backendUrl = $this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
}
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
return stripos($this->getHostWithPort($backendUrl), $host) !== false;
$host = $this->request->getServer('HTTP_HOST', '');
return stripos($this->getHostWithPort($backendUrl), (string) $host) !== false;
}

/**
Expand All @@ -116,9 +137,11 @@ public function isHostBackend()
*/
private function getHostWithPort($url)
{
$scheme = parse_url(trim($url), PHP_URL_SCHEME);
$host = parse_url(trim($url), PHP_URL_HOST);
$port = parse_url(trim($url), PHP_URL_PORT);
$this->uri->parse($url);
$scheme = $this->uri->getScheme();
$host = $this->uri->getHost();
$port = $this->uri->getPort();

if (!$port) {
$port = isset($this->standardPorts[$scheme]) ? $this->standardPorts[$scheme] : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ class FrontNameResolverTest extends \PHPUnit\Framework\TestCase
*/
protected $scopeConfigMock;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Zend\Uri\Uri
*/
protected $uri;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\Request\Http
*/
protected $request;

/**
* @var string
*/
Expand All @@ -41,9 +51,19 @@ protected function setUp()
->method('get')
->with(ConfigOptionsList::CONFIG_PATH_BACKEND_FRONTNAME)
->will($this->returnValue($this->_defaultFrontName));
$this->uri = $this->createMock(\Zend\Uri\Uri::class);

$this->request = $this->createMock(\Magento\Framework\App\Request\Http::class);

$this->configMock = $this->createMock(\Magento\Backend\App\Config::class);
$this->scopeConfigMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
$this->model = new FrontNameResolver($this->configMock, $deploymentConfigMock, $this->scopeConfigMock);
$this->model = new FrontNameResolver(
$this->configMock,
$deploymentConfigMock,
$this->scopeConfigMock,
$this->uri,
$this->request
);
}

public function testIfCustomPathUsed()
Expand Down Expand Up @@ -93,7 +113,6 @@ public function testIfCustomPathNotUsed()
*/
public function testIsHostBackend($url, $host, $useCustomAdminUrl, $customAdminUrl, $expectedValue)
{
$_SERVER['HTTP_HOST'] = $host;
$this->scopeConfigMock->expects($this->exactly(2))
->method('getValue')
->will(
Expand All @@ -115,6 +134,41 @@ public function testIsHostBackend($url, $host, $useCustomAdminUrl, $customAdminU
]
)
);

$this->request->expects($this->any())
->method('getServer')
->will($this->returnValue($host));

$urlParts = [];
$this->uri->expects($this->once())
->method('parse')
->willReturnCallback(
function ($url) use (&$urlParts) {
$urlParts = parse_url($url);
}
);
$this->uri->expects($this->once())
->method('getScheme')
->willReturnCallback(
function () use (&$urlParts) {
return array_key_exists('scheme', $urlParts) ? $urlParts['scheme'] : '';
}
);
$this->uri->expects($this->once())
->method('getHost')
->willReturnCallback(
function () use (&$urlParts) {
return array_key_exists('host', $urlParts) ? $urlParts['host'] : '';
}
);
$this->uri->expects($this->once())
->method('getPort')
->willReturnCallback(
function () use (&$urlParts) {
return array_key_exists('port', $urlParts) ? $urlParts['port'] : '';
}
);

$this->assertEquals($this->model->isHostBackend(), $expectedValue);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-backup": "*",
"magento/module-catalog": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-cron": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Braintree/Model/LocaleResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getLocale()
$locale = $this->localeMap[$this->resolver->getLocale()] ?? $this->resolver->getLocale();
$allowedLocales = $this->config->getValue('supported_locales');

return strpos($allowedLocales, $locale) !== false ? $locale : 'en_US';
return strpos($allowedLocales, (string) $locale) !== false ? $locale : 'en_US';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Braintree/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"braintree/braintree_php": "3.35.0",
"magento/framework": "*",
"magento/magento-composer-installer": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/BundleGraphQl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/module-catalog": "*",
"magento/module-bundle": "*",
"magento/module-catalog-graph-ql": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/BundleImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-bundle": "*",
"magento/module-store": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CacheInvalidate/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-page-cache": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Captcha/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-checkout": "*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/CardinalCommerce/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0",
"php": "~7.1.3||~7.2.0||~7.3.0",
"magento/framework": "*",
"magento/module-checkout": "*",
"magento/module-payment": "*",
Expand Down
Loading

0 comments on commit fc7fb0d

Please sign in to comment.