magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento 2.4.4 shows an error, not a warning when using deprecated functionality for PHP 8.1

Open m2-amn opened this issue 3 years ago • 9 comments

Preconditions and environment

  • Magento 2.4.4
  • PHP 8.1 The release notes for Mangento 2.4.4 state that Magento 2.4.4 is compatible with PHP 8.1.

Steps to reproduce

Using deprecated functionality for PHP 8.1

Expected result

When using deprecated functionality for PHP 8.1, it's expected to be shown as a warning, not as an error. It should be different from the update that doesn't have backward compatibility.

Actual result

An error occurs instead of a warning

Additional information

No response

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [X] 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.
  • [ ] 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”.

m2-amn avatar Aug 04 '22 07:08 m2-amn

Hi @m2-amn. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Aug 04 '22 07:08 m2-assistant[bot]

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Aug 04 '22 08:08 m2-assistant[bot]

Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Aug 05 '22 09:08 m2-assistant[bot]

Hi @m2-amn ,

Thanks for your contribution and collaboration.

Kindly provide more information regarding the steps to reproduce the issue. So, that we can proceed further process.

Thanks

engcom-Lima avatar Aug 05 '22 09:08 engcom-Lima

Hello @engcom-Lima,

Thank you for your support.

Here is more information about errors. Magento 2.4.4 shows an error to pass null as an argument of a deprecated functionality for PHP 8.1 other than that that explicitly allow null. For instance: strlen(), nl2br()

An error is like below
Deprecated Functionality: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/app/code///***.php on line xxxx

Thank you

m2-amn avatar Aug 05 '22 14:08 m2-amn

Hi m2-amn ,

I have tried to reproduce the issue but issue is not reproducible to me. I have used strlen(),nl2br() in index.php but I didn't got any error in logs as well as on frontend. Kindly provide more information, so , that issue can be reproducible.

Thanks

engcom-Lima avatar Aug 09 '22 10:08 engcom-Lima

Hello @engcom-Lima,

It seems that other factors are involved, so please put this matter on hold at present. Thank you for your time.

m2-amn avatar Aug 10 '22 06:08 m2-amn

Hello @engcom-Lima,

It seems that other factors are involved, so please put this matter on hold at present. Thank you for your time.

Can you please let us know what did you find? I'm hitting the same issue on 2.4.5: https://github.com/magento/magento2/issues/35901

pmonosolo avatar Aug 10 '22 19:08 pmonosolo

Hi @pmonosolo ,

We had the same issues. I think PHP 8 changed the default error reporting level or is not listening to the display errors setting properly.

As a short term fix we modified app/bootstrap.php and changed the line: error_reporting(E_ALL); to: error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);

jasuten avatar Aug 11 '22 00:08 jasuten

Hello @jasuten,

Thanks for the report!

Can you please help us with the reproduction steps for your case?

Thanks

engcom-Hotel avatar Aug 19 '22 09:08 engcom-Hotel

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Aug 19 '22 09:08 m2-assistant[bot]

Hi @pmonosolo ,

We had the same issues. I think PHP 8 changed the default error reporting level or is not listening to the display errors setting properly.

As a short term fix we modified app/bootstrap.php and changed the line: error_reporting(E_ALL); to: error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);

Thanks!

I think it might be related to this: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Problem is that the error is not a depreciation error - unless I'm confused. It just shows up as normal error instead of a warning.

pmonosolo avatar Aug 19 '22 21:08 pmonosolo

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Oct 27 '22 07:10 m2-assistant[bot]

Hi @pmonosolo / @m2-amn I see, this issue got fixed in the scope of the internal Jira ticket AC-6385 by the internal team Related commits: https://github.com/magento/magento2/search?q=AC-6385&type=commits Based on the Jira ticket, the target version is 2.4.6. Can you please check with this and elaborate steps / configuration details if you are still facing any issues. Thank you.

engcom-November avatar Oct 27 '22 07:10 engcom-November

Hi @m2-amn, We are closing this issue as there has been no latest update on the same. Kindly reopen / create new issue if you are still facing any issues. Thank you.

engcom-November avatar Nov 11 '22 07:11 engcom-November

Request for this to be re-open -Commit https://github.com/magento/magento2/commit/4bfb545ebc97a2748596c84743176cea06aff222 does not fix the root cause

willtran avatar Feb 07 '23 23:02 willtran