diff --git a/.htaccess b/.htaccess index 01f8f8dd24df5bf518774b24c9843bdd0d61d73a..b48c8689c8c7891003e01aae9958d86bab798c7c 100644 --- a/.htaccess +++ b/.htaccess @@ -187,4 +187,4 @@ ## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags - #FileETag none \ No newline at end of file + #FileETag none diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php index 610d98e58895148dc796a8cc105dfd02c46d9915..3d71b3e7446a5008ab2b9230b7648da0cb28de71 100644 --- a/app/code/Magento/Version/Controller/Index/Index.php +++ b/app/code/Magento/Version/Controller/Index/Index.php @@ -9,6 +9,7 @@ namespace Magento\Version\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\ProductMetadataInterface; +use Magento\Framework\Exception\StateException; /** * Magento Version controller @@ -34,12 +35,16 @@ class Index extends Action * Sets the response body to ProductName/Major.MinorVersion (Edition). E.g.: Magento/0.42 (Community). Omits patch * version from response * + * @throws StateException * @return void */ public function execute() { - $fullVersion = explode('.', $this->productMetadata->getVersion()); - $majorMinorVersion = $fullVersion[0] . '.' . $fullVersion[1]; + $versionParts = explode('.', $this->productMetadata->getVersion()); + if(!isset($versionParts[0]) || !isset($versionParts[1])) { + return ; // Major and minor version are not set - return empty response + } + $majorMinorVersion = $versionParts[0] . '.' . $versionParts[1]; $this->getResponse()->setBody( $this->productMetadata->getName() . '/' . $majorMinorVersion . ' (' .