Skip to content
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

[Issue] Declare optional argument after required. #31291

Closed
2 of 4 tasks
m2-assistant bot opened this issue Dec 15, 2020 · 2 comments · Fixed by #31275
Closed
2 of 4 tasks

[Issue] Declare optional argument after required. #31291

m2-assistant bot opened this issue Dec 15, 2020 · 2 comments · Fixed by #31275
Assignees
Labels
Component: MediaGalleryUi Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@m2-assistant
Copy link

m2-assistant bot commented Dec 15, 2020

This issue is automatically created based on existing pull request: #31275: Declare optional argument after required.


Description

This prevents PHP fatal error when a plugin is added to the one of parent classes.

Manual testing scenarios

  1. Create a plugin for \Magento\Framework\View\Element\BlockInterface.
  2. Navigate to Content > Pages.

Plugin example

Open Magento/Cms/etc/di.xml and add the following code:

<type name="Magento\Framework\View\Element\BlockInterface">
    <plugin name="cms_plugin" type="Magento\Cms\Plugin\Block" />
</type>

Create Magento\Cms\Plugin\Block class:

<?php

namespace Magento\Cms\Plugin;

class Block
{
    /**
     * @param mixed $subject
     * @param mixed $result
     * @return mixed
     */
    public function afterToHtml(
        $subject,
        $result
    ) {
        return $result;
    }
}

Actual Result: ✖️ A fatal error will be rendered: 'Error: Cannot instantiate interface Magento\Framework\Data\OptionSourceInterface'Magento\Framework\Data\OptionSourceInterface

Screenshot from 2020-12-16 09-52-15

Expected Result: ✔️ The page is successfully loaded

Screenshot from 2020-12-16 10-36-58

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot added Component: MediaGalleryUi Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Dec 15, 2020
@engcom-Alfa engcom-Alfa added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Dec 16, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-39947 were created

Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team
Copy link
Contributor

Hi @m2-assistant[bot]. Thank you for your report.
The issue has been fixed in #31275 by @vovayatsyuk in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.3 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: MediaGalleryUi Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants