diff --git a/vendor/magento/module-backend/Model/Widget/Grid/Row/UrlGeneratorFactory.php b/vendor/magento/module-backend/Model/Widget/Grid/Row/UrlGeneratorFactory.php index c4d96e0cdc7dc..e0cd390a01c2f 100644 --- a/vendor/magento/module-backend/Model/Widget/Grid/Row/UrlGeneratorFactory.php +++ b/vendor/magento/module-backend/Model/Widget/Grid/Row/UrlGeneratorFactory.php @@ -36,11 +36,11 @@ public function __construct(\Magento\Framework\ObjectManagerInterface $objectMan */ public function createUrlGenerator($generatorClassName, array $arguments = []) { - $rowUrlGenerator = $this->_objectManager->create($generatorClassName, $arguments); - if (false === $rowUrlGenerator instanceof \Magento\Backend\Model\Widget\Grid\Row\GeneratorInterface) { + // Validate the type BEFORE instantiation. + if (!is_a($generatorClassName, \Magento\Backend\Model\Widget\Grid\Row\GeneratorInterface::class, true)) { throw new \InvalidArgumentException('Passed wrong parameters'); } - return $rowUrlGenerator; + return $this->_objectManager->create($generatorClassName, $arguments); } }