Skip to content

[Forwardport] Add missing false-check to the ConfiguredRegularPrice price-model #16658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

[Forwardport] Add missing false-check to the ConfiguredRegularPrice price-model #16658

wants to merge 4 commits into from

Conversation

mageprince
Copy link
Contributor

Original Pull Request

#15129

Description

parent::getValue() can return false while $this->configuredOptions->getItemOptionsValue only accepts float. So if the parent method returns false then it fails with the following error:

NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Magento\Catalog\Pricing\Price\ConfiguredOptions::getItemOptionsValue() must be of the type float, boolean given, called in /app/vendor/magento/module-catalog/Pricing/Price/ConfiguredRegularPrice.php on line 74 and defined in /app/vendor/magento/module-catalog/Pricing/Price/ConfiguredOptions.php:24

@magento-engcom-team
Copy link
Contributor

Hi @mageprince. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@mageprince mageprince changed the title Mageprince 2.3 patch pull 15129 Add missing false-check to the ConfiguredRegularPrice price-model Jul 9, 2018
@orlangur orlangur changed the title Add missing false-check to the ConfiguredRegularPrice price-model [Forwardport] Add missing false-check to the ConfiguredRegularPrice price-model Jul 11, 2018
Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mageprince during forwardport original PR author must be preserved in commits.

@@ -13,12 +13,12 @@
use Magento\Framework\Pricing\PriceCurrencyInterface;

/**
* Configured regular price model.
* Configured regular price model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore all dots and don't touch them in the future.

@@ -57,23 +57,22 @@ public function __construct(
* @param ItemInterface $item
* @return $this
*/
public function setItem(ItemInterface $item) : ConfiguredRegularPrice
public function setItem(ItemInterface $item)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not remove existing type hints, feel free to add new ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. I revert it back.

@mageprince
Copy link
Contributor Author

Hi, @orlangur I have updated the files. Please check the PR.

@orlangur
Copy link
Contributor

orlangur commented Aug 2, 2018

@mageprince please rewrite branch history so that it looks exactly as https://github.com/magento/magento2/pull/15129/commits (cherry-pick commits instead of redoing them)

@orlangur
Copy link
Contributor

orlangur commented Aug 2, 2018

Port already done in #16820

@orlangur orlangur closed this Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants