diff --git a/.rector.php b/.rector.php index a132cabf00e..7aef87ea9d3 100644 --- a/.rector.php +++ b/.rector.php @@ -38,5 +38,15 @@ DeadCode\ClassMethod\RemoveUselessParamTagRector::class, DeadCode\ClassMethod\RemoveUselessReturnTagRector::class, DeadCode\Property\RemoveUselessVarTagRector::class, + Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector::class, TypeDeclaration\ClassMethod\ReturnNeverTypeRector::class, + ]) + ->withConfiguredRule(Rector\Php82\Rector\Param\AddSensitiveParameterAttributeRector::class, [ + 'sensitive_parameters' => [ + 'apiKey', + 'email', + 'useremail', + 'username', + 'password' + ], ]); \ No newline at end of file diff --git a/app/code/core/Mage/Admin/Model/Resource/User.php b/app/code/core/Mage/Admin/Model/Resource/User.php index ba8b88dff89..29573825685 100644 --- a/app/code/core/Mage/Admin/Model/Resource/User.php +++ b/app/code/core/Mage/Admin/Model/Resource/User.php @@ -74,7 +74,7 @@ public function recordLogin(Mage_Admin_Model_User $user) * @param string $username * @return false|array */ - public function loadByUsername($username) + public function loadByUsername(#[\SensitiveParameter] $username) { $adapter = $this->_getReadAdapter(); diff --git a/app/code/core/Mage/Admin/Model/Session.php b/app/code/core/Mage/Admin/Model/Session.php index 8ac0c92c878..098e6f400c5 100644 --- a/app/code/core/Mage/Admin/Model/Session.php +++ b/app/code/core/Mage/Admin/Model/Session.php @@ -142,7 +142,7 @@ protected function logoutIndirect() * @param Mage_Core_Controller_Request_Http $request * @return Mage_Admin_Model_User|null */ - public function login($username, $password, $request = null) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $password, $request = null) { if (empty($username) || empty($password)) { return null; @@ -306,7 +306,7 @@ protected function _getRequestUri($request = null) * @param string $message * @param Mage_Core_Controller_Request_Http|null $request */ - protected function _loginFailed($e, $request, $username, $message) + protected function _loginFailed($e, $request, #[\SensitiveParameter] $username, $message) { try { Mage::dispatchEvent('admin_session_user_login_failed', [ diff --git a/app/code/core/Mage/Admin/Model/User.php b/app/code/core/Mage/Admin/Model/User.php index f78537318d1..3b03e0e784c 100644 --- a/app/code/core/Mage/Admin/Model/User.php +++ b/app/code/core/Mage/Admin/Model/User.php @@ -372,7 +372,7 @@ public function getAclRole() * @return bool * @throws Mage_Core_Exception */ - public function authenticate($username, $password) + public function authenticate(#[\SensitiveParameter] $username, #[\SensitiveParameter] $password) { $config = Mage::getStoreConfigFlag('admin/security/use_case_sensitive_login'); $result = false; @@ -425,7 +425,7 @@ public function validatePasswordHash(string $string1, string $string2): bool * @return $this * @throws Mage_Core_Exception */ - public function login($username, $password) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $password) { if ($this->authenticate($username, $password)) { $this->getResource()->recordLogin($this); @@ -460,7 +460,7 @@ public function reload() * @param string $username * @return $this */ - public function loadByUsername($username) + public function loadByUsername(#[\SensitiveParameter] $username) { $this->setData($this->getResource()->loadByUsername($username)); return $this; @@ -483,7 +483,7 @@ public function hasAssigned2Role($user) * @param string $password * @return string */ - protected function _getEncodedPassword($password) + protected function _getEncodedPassword(#[\SensitiveParameter] $password) { return Mage::helper('core')->getHash($password, self::HASH_SALT_LENGTH); } @@ -641,7 +641,7 @@ public function validate() * @return array|true * @throws Zend_Validate_Exception */ - public function validateCurrentPassword($password) + public function validateCurrentPassword(#[\SensitiveParameter] $password) { $result = []; diff --git a/app/code/core/Mage/Adminhtml/Controller/Action.php b/app/code/core/Mage/Adminhtml/Controller/Action.php index 4815c83c521..ce49e4e37b2 100644 --- a/app/code/core/Mage/Adminhtml/Controller/Action.php +++ b/app/code/core/Mage/Adminhtml/Controller/Action.php @@ -414,7 +414,7 @@ protected function _validateSecretKey() * * @return mixed - returns true or array of errors */ - protected function _validateCurrentPassword($password) + protected function _validateCurrentPassword(#[\SensitiveParameter] $password) { $user = Mage::getSingleton('admin/session')->getUser(); return $user->validateCurrentPassword($password); diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 0687ea50486..1c80c8774c9 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -131,7 +131,7 @@ public function cleanOldSessions(?Mage_Api_Model_User $user) * @param string $username * @return array */ - public function loadByUsername($username) + public function loadByUsername(#[\SensitiveParameter] $username) { $adapter = $this->_getReadAdapter(); $select = $adapter->select()->from($this->getTable('api/user')) diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 50fbc2b441b..5ff7019849e 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -207,7 +207,7 @@ protected function _prepareResourceModelName($resource) * @param string $apiKey * @return string */ - public function login($username, $apiKey = null) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $apiKey = null) { if (empty($username) || empty($apiKey)) { return $this->_fault('invalid_request_param'); diff --git a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php index a1144a4d434..e403a37a1ee 100644 --- a/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php +++ b/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php @@ -80,7 +80,7 @@ public function __call($function, $args) * @param string $apiKey * @return stdClass */ - public function login($username, $apiKey = null) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $apiKey = null) { if (is_object($username)) { $apiKey = $username->apiKey; diff --git a/app/code/core/Mage/Api/Model/Session.php b/app/code/core/Mage/Api/Model/Session.php index af585683951..22ca0e1ee07 100644 --- a/app/code/core/Mage/Api/Model/Session.php +++ b/app/code/core/Mage/Api/Model/Session.php @@ -122,7 +122,7 @@ public function getIsInstaLogin(): bool * @return mixed * @throws Mage_Core_Exception */ - public function login($username, $apiKey) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $apiKey) { $user = Mage::getModel('api/user') ->setSessid($this->getSessionId()); diff --git a/app/code/core/Mage/Api/Model/User.php b/app/code/core/Mage/Api/Model/User.php index bbd93da3173..f63b550777b 100644 --- a/app/code/core/Mage/Api/Model/User.php +++ b/app/code/core/Mage/Api/Model/User.php @@ -238,7 +238,7 @@ public function getAclRole() * @return bool * @throws Exception */ - public function authenticate($username, $apiKey) + public function authenticate(#[\SensitiveParameter] $username, #[\SensitiveParameter] $apiKey) { $this->loadByUsername($username); if (!$this->getId()) { @@ -261,7 +261,7 @@ public function authenticate($username, $apiKey) * @return Mage_Api_Model_User * @throws Exception */ - public function login($username, $apiKey) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $apiKey) { $sessId = $this->getSessid(); if ($this->authenticate($username, $apiKey)) { @@ -295,7 +295,7 @@ public function reload() * @param string $username * @return $this */ - public function loadByUsername($username) + public function loadByUsername(#[\SensitiveParameter] $username) { $this->setData($this->getResource()->loadByUsername($username)); return $this; @@ -342,7 +342,7 @@ public function hasAssigned2Role($user) * @param string $apiKey * @return string */ - protected function _getEncodedApiKey($apiKey) + protected function _getEncodedApiKey(#[\SensitiveParameter] $apiKey) { return Mage::helper('core')->getHash($apiKey, Mage_Admin_Model_User::HASH_SALT_LENGTH); } diff --git a/app/code/core/Mage/Checkout/Model/Type/Abstract.php b/app/code/core/Mage/Checkout/Model/Type/Abstract.php index dd831202e7b..8b9ffc9fa83 100644 --- a/app/code/core/Mage/Checkout/Model/Type/Abstract.php +++ b/app/code/core/Mage/Checkout/Model/Type/Abstract.php @@ -148,7 +148,7 @@ protected function _createOrderFromAddress($address) * @param Mage_Sales_Model_Order $order * @deprecated after 1.4.0.0-rc1 */ - protected function _emailOrderConfirmation($email, $name, $order) + protected function _emailOrderConfirmation(#[\SensitiveParameter] $email, $name, $order) { $mailer = Mage::getModel('core/email') ->setTemplate('email/order.phtml') diff --git a/app/code/core/Mage/Checkout/Model/Type/Onepage.php b/app/code/core/Mage/Checkout/Model/Type/Onepage.php index 6abf642758e..a4268a6a11b 100644 --- a/app/code/core/Mage/Checkout/Model/Type/Onepage.php +++ b/app/code/core/Mage/Checkout/Model/Type/Onepage.php @@ -911,7 +911,7 @@ protected function validateOrder() * @param int $websiteId * @return false|Mage_Customer_Model_Customer */ - protected function _customerEmailExists($email, $websiteId = null) + protected function _customerEmailExists(#[\SensitiveParameter] $email, $websiteId = null) { $customer = Mage::getModel('customer/customer'); if ($websiteId) { diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php index 5cb76e98ab6..d2cab63abcb 100644 --- a/app/code/core/Mage/Core/Helper/Data.php +++ b/app/code/core/Mage/Core/Helper/Data.php @@ -284,7 +284,7 @@ public function getRandomString($len, $chars = null) * @param string|int|bool $salt * @return string */ - public function getHash($password, $salt = false) + public function getHash(#[\SensitiveParameter] $password, $salt = false) { return $this->getEncryptor()->getHash($password, $salt); } @@ -296,7 +296,7 @@ public function getHash($password, $salt = false) * @param mixed $salt * @return string */ - public function getHashPassword($password, $salt = false) + public function getHashPassword(#[\SensitiveParameter] $password, $salt = false) { $encryptionModel = $this->getEncryptor(); $latestVersionHash = $this->getVersionHash($encryptionModel); @@ -312,7 +312,7 @@ public function getHashPassword($password, $salt = false) * @return bool * @throws Exception */ - public function validateHash($password, $hash) + public function validateHash(#[\SensitiveParameter] $password, $hash) { return $this->getEncryptor()->validateHash($password, $hash); } diff --git a/app/code/core/Mage/Core/Model/Email/Info.php b/app/code/core/Mage/Core/Model/Email/Info.php index 1913b6dfcab..f037198e98e 100644 --- a/app/code/core/Mage/Core/Model/Email/Info.php +++ b/app/code/core/Mage/Core/Model/Email/Info.php @@ -62,7 +62,7 @@ class Mage_Core_Model_Email_Info extends Varien_Object * @param string|null $name * @return $this */ - public function addBcc($email, $name = null) + public function addBcc(#[\SensitiveParameter] $email, $name = null) { $this->_bccNames[] = $name; $this->_bccEmails[] = $email; @@ -76,7 +76,7 @@ public function addBcc($email, $name = null) * @param array|string|null $name * @return $this */ - public function addTo($email, $name = null) + public function addTo(#[\SensitiveParameter] $email, $name = null) { $this->_toNames[] = $name; $this->_toEmails[] = $email; diff --git a/app/code/core/Mage/Core/Model/Email/Template.php b/app/code/core/Mage/Core/Model/Email/Template.php index c53cb6f7a91..1afb3b64869 100644 --- a/app/code/core/Mage/Core/Model/Email/Template.php +++ b/app/code/core/Mage/Core/Model/Email/Template.php @@ -370,7 +370,7 @@ public function getInclude($template, array $variables) * @param array $variables template variables * @return bool **/ - public function send($email, $name = null, array $variables = []) + public function send(#[\SensitiveParameter] $email, $name = null, array $variables = []) { if (!$this->isValidForSend()) { Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted @@ -498,7 +498,7 @@ public function send($email, $name = null, array $variables = []) * * @return $this */ - public function sendTransactional($templateId, $sender, $email, $name, $vars = [], $storeId = null) + public function sendTransactional($templateId, $sender, #[\SensitiveParameter] $email, $name, $vars = [], $storeId = null) { $this->setSentSuccess(false); if (($storeId === null) && $this->getDesignConfig()->getStore()) { @@ -583,7 +583,7 @@ public function addBcc($bcc) * @param string $email * @return $this */ - public function setReturnPath($email) + public function setReturnPath(#[\SensitiveParameter] $email) { $this->getMail()->setReturnPath($email); return $this; @@ -595,7 +595,7 @@ public function setReturnPath($email) * @param string $email * @return $this */ - public function setReplyTo($email) + public function setReplyTo(#[\SensitiveParameter] $email) { $this->getMail()->setReplyTo($email); return $this; diff --git a/app/code/core/Mage/Core/Model/Encryption.php b/app/code/core/Mage/Core/Model/Encryption.php index 4dd793360bd..af186883cff 100644 --- a/app/code/core/Mage/Core/Model/Encryption.php +++ b/app/code/core/Mage/Core/Model/Encryption.php @@ -70,7 +70,7 @@ public function setHelper($helper) * @param mixed $salt * @return string */ - public function getHash($password, $salt = false) + public function getHash(#[\SensitiveParameter] $password, $salt = false) { if (is_int($salt)) { $salt = $this->_helper->getRandomString($salt); @@ -87,7 +87,7 @@ public function getHash($password, $salt = false) * @param mixed $salt * @return string */ - public function getHashPassword($password, $salt = null) + public function getHashPassword(#[\SensitiveParameter] $password, $salt = null) { if (is_int($salt)) { $salt = $this->_helper->getRandomString($salt); @@ -124,7 +124,7 @@ public function hash($data, $version = self::HASH_VERSION_MD5) * @return bool * @throws Exception */ - public function validateHash($password, $hash) + public function validateHash(#[\SensitiveParameter] $password, $hash) { if (strlen($password) > self::MAXIMUM_PASSWORD_LENGTH) { return false; @@ -144,7 +144,7 @@ public function validateHash($password, $hash) * @param int $version * @return bool */ - public function validateHashByVersion($password, $hash, $version = self::HASH_VERSION_MD5) + public function validateHashByVersion(#[\SensitiveParameter] $password, $hash, $version = self::HASH_VERSION_MD5) { if ($version == self::HASH_VERSION_LATEST && $version == $this->_helper->getVersionHash($this)) { return password_verify($password, $hash); diff --git a/app/code/core/Mage/Customer/Helper/Data.php b/app/code/core/Mage/Customer/Helper/Data.php index 7f36bb2936e..b7638aad38a 100644 --- a/app/code/core/Mage/Customer/Helper/Data.php +++ b/app/code/core/Mage/Customer/Helper/Data.php @@ -360,7 +360,7 @@ public function isConfirmationRequired() * @param string $email * @return string */ - public function getEmailConfirmationUrl($email = null) + public function getEmailConfirmationUrl(#[\SensitiveParameter] $email = null) { return $this->_getUrl('customer/account/confirmation', ['email' => $email]); } diff --git a/app/code/core/Mage/Customer/Model/Customer.php b/app/code/core/Mage/Customer/Model/Customer.php index dd556419824..6beaa5ed543 100644 --- a/app/code/core/Mage/Customer/Model/Customer.php +++ b/app/code/core/Mage/Customer/Model/Customer.php @@ -257,7 +257,7 @@ public function getSharingConfig() * @throws Mage_Core_Exception * @return true */ - public function authenticate($login, $password) + public function authenticate($login, #[\SensitiveParameter] $password) { $this->loadByEmail($login); if ($this->getConfirmation() && $this->isConfirmationRequired()) { @@ -489,7 +489,7 @@ public function getPassword(): string * @param string $password * @return $this */ - public function setPassword($password) + public function setPassword(#[\SensitiveParameter] $password) { $this->setData('password', $password); $this->setPasswordHash($this->hashPassword($password)); @@ -504,7 +504,7 @@ public function setPassword($password) * @param int $salt * @return string */ - public function hashPassword($password, $salt = null) + public function hashPassword(#[\SensitiveParameter] $password, $salt = null) { /** @var Mage_Core_Helper_Data $helper */ $helper = $this->_getHelper('core'); @@ -548,7 +548,7 @@ public function generatePassword($length = 8) * @return bool * @throws Exception */ - public function validatePassword($password) + public function validatePassword(#[\SensitiveParameter] $password) { $hash = $this->getPasswordHash(); if (!$hash) { @@ -563,7 +563,7 @@ public function validatePassword($password) * @param string $password * @return string */ - public function encryptPassword($password) + public function encryptPassword(#[\SensitiveParameter] $password) { return Mage::helper('core')->encrypt($password); } @@ -574,7 +574,7 @@ public function encryptPassword($password) * @param string $password * @return string */ - public function decryptPassword($password) + public function decryptPassword(#[\SensitiveParameter] $password) { return Mage::helper('core')->decrypt($password); } @@ -722,7 +722,7 @@ public function isAddressPrimary(Mage_Customer_Model_Address $address) * @throws Mage_Core_Exception * @return $this */ - public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0', $password = null) + public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0', #[\SensitiveParameter] $password = null) { $types = [ 'registered' => self::XML_PATH_REGISTER_EMAIL_TEMPLATE, // welcome email, when confirmation is disabled diff --git a/app/code/core/Mage/Customer/Model/Flowpassword.php b/app/code/core/Mage/Customer/Model/Flowpassword.php index bec94a635bb..48ad6a07e21 100644 --- a/app/code/core/Mage/Customer/Model/Flowpassword.php +++ b/app/code/core/Mage/Customer/Model/Flowpassword.php @@ -60,7 +60,7 @@ protected function _prepareData() * @param string $email * @return bool */ - public function checkCustomerForgotPasswordFlowEmail($email) + public function checkCustomerForgotPasswordFlowEmail(#[\SensitiveParameter] $email) { $helper = Mage::helper('customer'); $checkForgotPasswordFlowTypes = [ diff --git a/app/code/core/Mage/Customer/Model/Resource/Customer.php b/app/code/core/Mage/Customer/Model/Resource/Customer.php index 811a01a5f45..bd14798e921 100644 --- a/app/code/core/Mage/Customer/Model/Resource/Customer.php +++ b/app/code/core/Mage/Customer/Model/Resource/Customer.php @@ -190,7 +190,7 @@ protected function _getLoadRowSelect($object, $rowId) * @param bool $testOnly * @return $this */ - public function loadByEmail(Mage_Customer_Model_Customer $customer, $email, $testOnly = false) + public function loadByEmail(Mage_Customer_Model_Customer $customer, #[\SensitiveParameter] $email, $testOnly = false) { $adapter = $this->_getReadAdapter(); $bind = ['customer_email' => $email]; diff --git a/app/code/core/Mage/Customer/Model/Session.php b/app/code/core/Mage/Customer/Model/Session.php index 10708d940c7..a3b547d545b 100644 --- a/app/code/core/Mage/Customer/Model/Session.php +++ b/app/code/core/Mage/Customer/Model/Session.php @@ -225,7 +225,7 @@ public function checkCustomerId($customerId) * @param string $password * @return bool */ - public function login($username, $password) + public function login(#[\SensitiveParameter] $username, #[\SensitiveParameter] $password) { /** @var Mage_Customer_Model_Customer $customer */ $customer = Mage::getModel('customer/customer') diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php index e211e48dc3a..2214ad8fe21 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer.php @@ -517,7 +517,7 @@ protected function _saveCustomerEntity(array $entityRowsIn, array $entityRowsUp) * @param string $websiteCode * @return string|null */ - public function getCustomerId($email, $websiteCode) + public function getCustomerId(#[\SensitiveParameter] $email, $websiteCode) { if (isset($this->_oldCustomers[$email][$websiteCode])) { return $this->_oldCustomers[$email][$websiteCode]; diff --git a/app/code/core/Mage/Newsletter/Model/Subscriber.php b/app/code/core/Mage/Newsletter/Model/Subscriber.php index a4df7378d42..7c3d4e1bf65 100644 --- a/app/code/core/Mage/Newsletter/Model/Subscriber.php +++ b/app/code/core/Mage/Newsletter/Model/Subscriber.php @@ -306,7 +306,7 @@ public function randomSequence($length = 32) * @throws Exception * @return int */ - public function subscribe($email) + public function subscribe(#[\SensitiveParameter] $email) { $this->loadByEmail($email); $customerSession = Mage::getSingleton('customer/session'); diff --git a/app/code/core/Mage/Oauth/Helper/Data.php b/app/code/core/Mage/Oauth/Helper/Data.php index 17a19603bf2..bd0e15696d6 100644 --- a/app/code/core/Mage/Oauth/Helper/Data.php +++ b/app/code/core/Mage/Oauth/Helper/Data.php @@ -221,7 +221,7 @@ public function getCleanupExpirationPeriod() * @param string $applicationName * @param string $status */ - public function sendNotificationOnTokenStatusChange($userEmail, $userName, $applicationName, $status) + public function sendNotificationOnTokenStatusChange(#[\SensitiveParameter] $userEmail, #[\SensitiveParameter] $userName, $applicationName, $status) { /** @var Mage_Core_Model_Email_Template $mailTemplate */ $mailTemplate = Mage::getModel('core/email_template'); diff --git a/app/code/core/Mage/Paypal/Model/Express/Checkout.php b/app/code/core/Mage/Paypal/Model/Express/Checkout.php index 1d8bb64311d..c1286c1bbfe 100644 --- a/app/code/core/Mage/Paypal/Model/Express/Checkout.php +++ b/app/code/core/Mage/Paypal/Model/Express/Checkout.php @@ -1065,7 +1065,7 @@ public function getCustomerSession() * @param string $email * @return bool */ - protected function _customerEmailExists($email) + protected function _customerEmailExists(#[\SensitiveParameter] $email) { $result = false; $customer = Mage::getModel('customer/customer'); diff --git a/app/code/core/Mage/ProductAlert/Model/Observer.php b/app/code/core/Mage/ProductAlert/Model/Observer.php index 84e68b7780b..feda6fa2280 100644 --- a/app/code/core/Mage/ProductAlert/Model/Observer.php +++ b/app/code/core/Mage/ProductAlert/Model/Observer.php @@ -85,9 +85,9 @@ protected function _getWebsites() * * @return $this */ - protected function _processPrice(Mage_ProductAlert_Model_Email $email) + protected function _processPrice(Mage_ProductAlert_Model_Email $emailAlertModel) { - $email->setType('price'); + $emailAlertModel->setType('price'); $originalStore = Mage::app()->getStore(); foreach ($this->_getWebsites() as $website) { /** @var Mage_Core_Model_Website $website */ @@ -109,7 +109,7 @@ protected function _processPrice(Mage_ProductAlert_Model_Email $email) } $previousCustomer = null; - $email->setWebsite($website); + $emailAlertModel->setWebsite($website); Mage::app()->setCurrentStore($website->getDefaultGroup()->getDefaultStore()); /** @var Mage_ProductAlert_Model_Price $alert */ foreach ($collection as $alert) { @@ -117,14 +117,14 @@ protected function _processPrice(Mage_ProductAlert_Model_Email $email) if (!$previousCustomer || $previousCustomer->getId() != $alert->getCustomerId()) { $customer = Mage::getModel('customer/customer')->load($alert->getCustomerId()); if ($previousCustomer) { - $email->send(); + $emailAlertModel->send(); } if (!$customer->getId()) { continue; } $previousCustomer = $customer; - $email->clean(); - $email->setCustomer($customer); + $emailAlertModel->clean(); + $emailAlertModel->setCustomer($customer); } else { $customer = $previousCustomer; } @@ -140,7 +140,7 @@ protected function _processPrice(Mage_ProductAlert_Model_Email $email) $productPrice = $product->getFinalPrice(); $product->setFinalPrice(Mage::helper('tax')->getPrice($product, $productPrice)); $product->setPrice(Mage::helper('tax')->getPrice($product, $product->getPrice())); - $email->addPriceProduct($product); + $emailAlertModel->addPriceProduct($product); $alert->setPrice($productPrice); $alert->setLastSendDate(Mage::getModel('core/date')->gmtDate()); @@ -154,7 +154,7 @@ protected function _processPrice(Mage_ProductAlert_Model_Email $email) } if ($previousCustomer) { try { - $email->send(); + $emailAlertModel->send(); } catch (Exception $e) { $this->_errors[] = $e->getMessage(); } @@ -169,9 +169,9 @@ protected function _processPrice(Mage_ProductAlert_Model_Email $email) * * @return $this */ - protected function _processStock(Mage_ProductAlert_Model_Email $email) + protected function _processStock(Mage_ProductAlert_Model_Email $emailAlertModel) { - $email->setType('stock'); + $emailAlertModel->setType('stock'); $originalStore = Mage::app()->getStore(); foreach ($this->_getWebsites() as $website) { @@ -195,7 +195,7 @@ protected function _processStock(Mage_ProductAlert_Model_Email $email) } $previousCustomer = null; - $email->setWebsite($website); + $emailAlertModel->setWebsite($website); Mage::app()->setCurrentStore($website->getDefaultGroup()->getDefaultStore()); /** @var Mage_ProductAlert_Model_Stock $alert */ foreach ($collection as $alert) { @@ -203,14 +203,14 @@ protected function _processStock(Mage_ProductAlert_Model_Email $email) if (!$previousCustomer || $previousCustomer->getId() != $alert->getCustomerId()) { $customer = Mage::getModel('customer/customer')->load($alert->getCustomerId()); if ($previousCustomer) { - $email->send(); + $emailAlertModel->send(); } if (!$customer->getId()) { continue; } $previousCustomer = $customer; - $email->clean(); - $email->setCustomer($customer); + $emailAlertModel->clean(); + $emailAlertModel->setCustomer($customer); } else { $customer = $previousCustomer; } @@ -226,7 +226,7 @@ protected function _processStock(Mage_ProductAlert_Model_Email $email) $product->setCustomerGroupId($customer->getGroupId()); if ($product->isSalable()) { - $email->addStockProduct($product); + $emailAlertModel->addStockProduct($product); $alert->setSendDate(Mage::getModel('core/date')->gmtDate()); $alert->setSendCount($alert->getSendCount() + 1); @@ -240,7 +240,7 @@ protected function _processStock(Mage_ProductAlert_Model_Email $email) if ($previousCustomer) { try { - $email->send(); + $emailAlertModel->send(); } catch (Exception $e) { $this->_errors[] = $e->getMessage(); } diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php index 9e1f3c76cba..5f3d2416ec2 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php @@ -111,11 +111,11 @@ public function info($invoiceIncrementId) * @param string $orderIncrementId * @param array $itemsQty * @param string $comment - * @param bool $email + * @param bool $notifyCustomer * @param bool $includeComment * @return string */ - public function create($orderIncrementId, $itemsQty = [], $comment = null, $email = false, $includeComment = false) + public function create($orderIncrementId, $itemsQty = [], $comment = null, $notifyCustomer = false, $includeComment = false) { $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId); @@ -139,10 +139,10 @@ public function create($orderIncrementId, $itemsQty = [], $comment = null, $emai $invoice->register(); if ($comment !== null) { - $invoice->addComment($comment, $email); + $invoice->addComment($comment, $notifyCustomer); } - if ($email) { + if ($notifyCustomer) { $invoice->setEmailSent(true); } @@ -154,7 +154,7 @@ public function create($orderIncrementId, $itemsQty = [], $comment = null, $emai ->addObject($invoice->getOrder()) ->save(); - $invoice->sendEmail($email, ($includeComment ? $comment : '')); + $invoice->sendEmail($notifyCustomer, ($includeComment ? $comment : '')); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); } @@ -171,7 +171,8 @@ public function create($orderIncrementId, $itemsQty = [], $comment = null, $emai * @param bool $includeComment * @return bool */ - public function addComment($invoiceIncrementId, $comment, $email = false, $includeComment = false) + public function addComment($invoiceIncrementId, $comment, #[\SensitiveParameter] + $email = false, $includeComment = false) { $invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId($invoiceIncrementId); diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php index 46f33cad5f6..f9a41e98cbd 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Api/V2.php @@ -28,11 +28,11 @@ class Mage_Sales_Model_Order_Invoice_Api_V2 extends Mage_Sales_Model_Order_Invoi * @param string $invoiceIncrementId * @param array $itemsQty * @param string $comment - * @param bool $email + * @param bool $notifyCustomer * @param bool $includeComment * @return string */ - public function create($invoiceIncrementId, $itemsQty = [], $comment = null, $email = false, $includeComment = false) + public function create($invoiceIncrementId, $itemsQty = [], $comment = null, $notifyCustomer = false, $includeComment = false) { $order = Mage::getModel('sales/order')->loadByIncrementId($invoiceIncrementId); $itemsQty = $this->_prepareItemQtyData($itemsQty); @@ -56,10 +56,10 @@ public function create($invoiceIncrementId, $itemsQty = [], $comment = null, $em $invoice->register(); if ($comment !== null) { - $invoice->addComment($comment, $email); + $invoice->addComment($comment, $notifyCustomer); } - if ($email) { + if ($notifyCustomer) { $invoice->setEmailSent(true); } @@ -67,7 +67,7 @@ public function create($invoiceIncrementId, $itemsQty = [], $comment = null, $em try { Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save(); - $invoice->sendEmail($email, ($includeComment ? $comment : '')); + $invoice->sendEmail($notifyCustomer, ($includeComment ? $comment : '')); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); } diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php index 1f8beec8dcf..29580647035 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php @@ -106,7 +106,7 @@ public function info($shipmentIncrementId) * @param string $orderIncrementId * @param array $itemsQty * @param string $comment - * @param bool $email + * @param bool $notifyCustomer * @param bool $includeComment * @return string */ @@ -114,7 +114,7 @@ public function create( $orderIncrementId, $itemsQty = [], $comment = null, - $email = false, + $notifyCustomer = false, $includeComment = false ) { $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId); @@ -136,8 +136,8 @@ public function create( $shipment = $order->prepareShipment($itemsQty); if ($shipment) { $shipment->register(); - $shipment->addComment($comment, $email && $includeComment); - if ($email) { + $shipment->addComment($comment, $notifyCustomer && $includeComment); + if ($notifyCustomer) { $shipment->setEmailSent(true); } $shipment->getOrder()->setIsInProcess(true); @@ -146,7 +146,7 @@ public function create( ->addObject($shipment) ->addObject($shipment->getOrder()) ->save(); - $shipment->sendEmail($email, ($includeComment ? $comment : '')); + $shipment->sendEmail($notifyCustomer, ($includeComment ? $comment : '')); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); } @@ -297,7 +297,8 @@ public function infoTrack($shipmentIncrementId, $trackId) * @param bool $includeInEmail * @return bool */ - public function addComment($shipmentIncrementId, $comment, $email = false, $includeInEmail = false) + public function addComment($shipmentIncrementId, $comment, #[\SensitiveParameter] + $email = false, $includeInEmail = false) { $shipment = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentIncrementId); diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php index 68c346a1217..5b9b1e57f4a 100644 --- a/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php +++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php @@ -43,7 +43,7 @@ protected function _prepareItemQtyData($data) * @param string $orderIncrementId * @param array $itemsQty * @param string $comment - * @param bool $email + * @param bool $notifyCustomer * @param bool $includeComment * @return string */ @@ -51,7 +51,7 @@ public function create( $orderIncrementId, $itemsQty = [], $comment = null, - $email = false, + $notifyCustomer = false, $includeComment = false ) { $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId); @@ -74,8 +74,8 @@ public function create( $shipment = $order->prepareShipment($itemsQty); if ($shipment) { $shipment->register(); - $shipment->addComment($comment, $email && $includeComment); - if ($email) { + $shipment->addComment($comment, $notifyCustomer && $includeComment); + if ($notifyCustomer) { $shipment->setEmailSent(true); } $shipment->getOrder()->setIsInProcess(true); @@ -84,7 +84,7 @@ public function create( ->addObject($shipment) ->addObject($shipment->getOrder()) ->save(); - $shipment->sendEmail($email, ($includeComment ? $comment : '')); + $shipment->sendEmail($notifyCustomer, ($includeComment ? $comment : '')); } catch (Mage_Core_Exception $e) { $this->_fault('data_invalid', $e->getMessage()); }