diff --git a/app/Mage.php b/app/Mage.php index 1570ce0b1fa..8a019d43a7a 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -42,6 +42,12 @@ Varien_Autoload::register(); +/** AUTOLOADER PATCH **/ +if (file_exists($autoloaderPath = (getenv('COMPOSER_VENDOR_PATH') ?: BP . DS . 'vendor') . DS . 'autoload.php')) { + require $autoloaderPath; +} +/** AUTOLOADER PATCH **/ + /* Support additional includes, such as composer's vendor/autoload.php files */ foreach (glob(BP . DS . 'app' . DS . 'etc' . DS . 'includes' . DS . '*.php') as $path) { include_once $path; diff --git a/app/code/core/Mage/Captcha/Model/Zend.php b/app/code/core/Mage/Captcha/Model/Zend.php index 1da978abf2d..c7142e783a6 100644 --- a/app/code/core/Mage/Captcha/Model/Zend.php +++ b/app/code/core/Mage/Captcha/Model/Zend.php @@ -64,7 +64,7 @@ class Mage_Captcha_Model_Zend extends Zend_Captcha_Image implements Mage_Captcha /** * Generated word * - * @var string|null + * @var string */ protected $_word; @@ -483,7 +483,7 @@ protected function _setWord($word) protected function _clearWord() { $this->getSession()->unsetData($this->_getFormIdKey(self::SESSION_WORD)); - $this->_word = null; + $this->_word = ''; return $this; } diff --git a/app/code/core/Mage/Catalog/Helper/Image.php b/app/code/core/Mage/Catalog/Helper/Image.php index fdc415257e2..abe8cbdb96d 100644 --- a/app/code/core/Mage/Catalog/Helper/Image.php +++ b/app/code/core/Mage/Catalog/Helper/Image.php @@ -564,6 +564,10 @@ protected function getImageFile() */ protected function parseSize($string) { + if ($string === null) { + return false; + } + $size = explode('x', strtolower($string)); if (count($size) === 2) { return [ @@ -571,6 +575,7 @@ protected function parseSize($string) 'heigth' => ($size[1] > 0) ? $size[1] : null, ]; } + return false; } diff --git a/app/code/core/Mage/Core/Controller/Varien/Action.php b/app/code/core/Mage/Core/Controller/Varien/Action.php index e5a7629c935..464a75dbc57 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Action.php +++ b/app/code/core/Mage/Core/Controller/Varien/Action.php @@ -994,7 +994,7 @@ protected function _filterDates($array, $dateFields) ]); foreach ($dateFields as $dateField) { - if (array_key_exists($dateField, $array) && !empty($dateField)) { + if ($dateField && !empty($array[$dateField])) { $array[$dateField] = $filterInput->filter($array[$dateField]); $array[$dateField] = $filterInternal->filter($array[$dateField]); } diff --git a/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype/Validator.php b/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype/Validator.php index 842d962c88c..55f5257bf79 100644 --- a/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype/Validator.php +++ b/app/code/core/Mage/Eav/Model/Adminhtml/System/Config/Source/Inputtype/Validator.php @@ -22,7 +22,7 @@ class Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator extends Zend_Validate_InArray { /** - * @var array|null + * @inheritdoc */ protected $_messageTemplates; @@ -34,7 +34,7 @@ public function __construct() $haystack = $helper->getInputTypesValidatorData(); //reset message template and set custom - $this->_messageTemplates = null; + $this->_messageTemplates = []; $this->_initMessageTemplates(); //parent construct with options diff --git a/app/code/core/Mage/Payment/Helper/Data.php b/app/code/core/Mage/Payment/Helper/Data.php index d05dd380f52..5f6f6da6570 100644 --- a/app/code/core/Mage/Payment/Helper/Data.php +++ b/app/code/core/Mage/Payment/Helper/Data.php @@ -26,6 +26,18 @@ class Mage_Payment_Helper_Data extends Mage_Core_Helper_Abstract protected $_moduleName = 'Mage_Payment'; + /** + * Retrieve the class name of the payment method's model + * + * @param $code + * @return string|null + */ + public function getMethodModelClassName($code) + { + $key = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/model'; + return Mage::getStoreConfig($key); + } + /** * Retrieve method model object * @@ -34,8 +46,7 @@ class Mage_Payment_Helper_Data extends Mage_Core_Helper_Abstract */ public function getMethodInstance($code) { - $key = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/model'; - $class = Mage::getStoreConfig($key); + $class = $this->getMethodModelClassName($code); if (is_null($class)) { Mage::logException(new Exception(sprintf('Unknown payment method with code "%s"', $code))); return false; @@ -156,7 +167,13 @@ public function getRecurringProfileMethods($store = null) { $result = []; foreach ($this->getPaymentMethods($store) as $code => $data) { - $method = $this->getMethodInstance($code); + $paymentMethodModelClassName = $this->getMethodModelClassName($code); + if (!$paymentMethodModelClassName) { + continue; + } + + /** @var Mage_Payment_Model_Method_Abstract $method */ + $method = Mage::getModel($paymentMethodModelClassName); if ($method && $method->canManageRecurringProfiles()) { $result[] = $method; } @@ -207,8 +224,9 @@ public function getPaymentMethodList($sorted = true, $asLabelValue = false, $wit if ((isset($data['title']))) { $methods[$code] = $data['title']; } else { - if ($this->getMethodInstance($code)) { - $methods[$code] = $this->getMethodInstance($code)->getConfigData('title', $store); + $paymentMethodModelClassName = $this->getMethodModelClassName($code); + if ($paymentMethodModelClassName) { + $methods[$code] = Mage::getModel($paymentMethodModelClassName)->getConfigData('title', $store); } } if ($asLabelValue && $withGroups && isset($data['group'])) { diff --git a/dev/openmage/docker-compose.yml b/dev/openmage/docker-compose.yml index f12b1a44e7c..1ae91aaa292 100644 --- a/dev/openmage/docker-compose.yml +++ b/dev/openmage/docker-compose.yml @@ -10,7 +10,7 @@ services: - ../..:/var/www/html environment: - ENABLE_SENDMAIL=${ENABLE_SENDMAIL:-true} - - XDEBUG_CONFIG=${XDEBUG_CONFIG:-remote_connect_back=1 remote_enable=1 idekey=phpstorm} + - XDEBUG_CONFIG=${XDEBUG_CONFIG:-client_host=host.docker.internal mode=debug force_display_errors=1 start_with_request=yes} - MAGE_IS_DEVELOPER_MODE=${MAGE_IS_DEVELOPER_MODE:-1} links: - mysql diff --git a/dev/phpstan/stubs/Zend_Captcha_Word.stub b/dev/phpstan/stubs/Zend_Captcha_Word.stub deleted file mode 100644 index b1b60b63f70..00000000000 --- a/dev/phpstan/stubs/Zend_Captcha_Word.stub +++ /dev/null @@ -1,11 +0,0 @@ -|null - */ - protected $_messageTemplates; -} diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 5bb1048fdfd..eb99f86b075 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -71,9 +71,6 @@ parameters: # Instantiated class not found - lib/Varien/Image/Adapter.php - stubFiles: - - dev/phpstan/stubs/Zend_Captcha_Word.stub - - dev/phpstan/stubs/Zend_Validate_InArray.stub level: 4 checkFunctionNameCase: true checkInternalClassCaseSensitivity: true diff --git a/skin/frontend/rwd/default/js/msrp_rwd.js b/skin/frontend/rwd/default/js/msrp_rwd.js index fcaf20f9cc2..eaabb64c495 100644 --- a/skin/frontend/rwd/default/js/msrp_rwd.js +++ b/skin/frontend/rwd/default/js/msrp_rwd.js @@ -12,8 +12,8 @@ */ Catalog.Map.showHelp = Catalog.Map.showHelp.wrap(function (parent, event) { - var helpBox = $('map-popup'); - var bodyNode = $$('body')[0]; + var helpBox = document.getElementById('map-popup'); + var bodyNode = document.getElementsByTagName('body')[0]; // Resolve calculation bug in parent so we can actually use these classes... if (helpBox && this != Catalog.Map && Catalog.Map.active != this.link) {