Skip to content

\Magento\Config\Model\Config\Source\Email\Template::toOptionArray throws error when setPath() is not called first #29315

Closed
@willwright

Description

@willwright

Preconditions (*)

  1. dev-2.4-develop

Steps to reproduce (*)

  1. Create a custom module, plugin, or Observer
  2. Inject a concrete instance of \Magento\Framework\ObjectManagerInterface ($this->_objectManager) through the constructor
  3. Execute the following:
$sourceModelObj = $this->_objectManager->create('\Magento\Config\Model\Config\Source\Email\Template');
$optionsArray = $sourceModelObj->toOptionArray();
  1. Notice unhandled exception is written to the screen

Expected result (*)

  1. Should not throw an error
  2. Should return default collection options

Actual result (*)

Exception #0 (UnexpectedValueException): Email template '' is not defined.
<pre>#1 Magento\Email\Model\Template\Config->getTemplateLabel('') called at [vendor/magento/module-config/Model/Config/Source/Email/Template.php:64]
#2 Magento\Config\Model\Config\Source\Email\Template->toOptionArray() called at [app/code/Magesmith/ScopeExplorer/Block/Scopes.php:172]
#3 Magesmith\ScopeExplorer\Block\Scopes->getSourceModelValue('catalog_producta...') called at [app/code/Magesmith/ScopeExplorer/Block/Scopes.php:135]
#4 Magesmith\ScopeExplorer\Block\Scopes->getWebsiteScopeValue(&Magento\Store\Model\Website\Interceptor#00000000476d138d000000000886eb4d#) called at [app/code/Magesmith/ScopeExplorer/Block/Scopes.php:97]
#5 Magesmith\ScopeExplorer\Block\Scopes->hasScopeValue() called at [app/code/Magesmith/ScopeExplorer/view/adminhtml/templates/scopes.phtml:7]
#6 include('/mnt/f/www/local...') called at [vendor/magento/framework/View/TemplateEngine/Php.php:59]
#7 Magento\Framework\View\TemplateEngine\Php->render(&Magesmith\ScopeExplorer\Block\Scopes#00000000476d1f2e000000000886eb4d#, '/mnt/f/www/local...', array('csp' => &Magento\Csp\Helper\InlineUtil#00000000476d1d31000000000886eb4d#)) called at [vendor/magento/framework/Interception/Interceptor.php:58]

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [x ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: ConfigFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions