Since the upgrade from 2.2.x to 2.3.3 we have the problem that a customized tier price box is cached across all product pages.
I found a fix for this, by just changing the variable name.
This is the same in both versions:
use Magenerds\BasePrice\Helper\Data as MagenerdsBasePriceHelperData;
use Magento\Catalog\Model\Product;
use Magento\Framework\Json\Helper\Data;
use Magento\Framework\Math\Random;
use Magento\Framework\Pricing\Price\PriceInterface;
use Magento\Framework\Pricing\Render\RendererPool;
use Magento\Framework\View\Element\Template\Context;
class TierPricesWithBase extends \Magento\Catalog\Pricing\Render\PriceBox
This works:
public function __construct(
Context $context,
Product $saleableItem,
PriceInterface $price,
RendererPool $rendererPool,
Data $jsonHelper,
Random $mathRandom,
MagenerdsBasePriceHelperData $basePriceHelper,
array $data = []
) {
parent::__construct($context, $saleableItem, $price, $rendererPool, $jsonHelper, $mathRandom, $data);
$this->_basepriceHelper = $basePriceHelper;
}
This does not:
public function __construct(
Context $context,
Product $product,
PriceInterface $price,
RendererPool $rendererPool,
Data $jsonHelper,
Random $mathRandom,
MagenerdsBasePriceHelperData $basePriceHelper,
array $data = []
) {
parent::__construct($context, $product, $price, $rendererPool, $jsonHelper, $mathRandom, $data);
$this->_basepriceHelper = $basePriceHelper;
}
Only difference is the variable name $product.
How can the behavior differ? Is the object manager doing some reflection here based on variable names here and mess with the caching?
We are using PHP 7.2
