Passing null to parameter #1 ($string) is deprecated

Created on 27 September 2024, 8 months ago

Problem/Motivation

After enabling the animatecss_block module placing any new block from block_layout was sending the below error.

Object { message: '\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /admin/structure/block/add/entity_view%3Anode/mtcbtheme_bs4?region=drawer_top\nStatusText: parsererror\nResponseText: Deprecated: strtr(): Passing null to parameter #1 ($string) of type string is deprecated in /app/docroot/modules/contrib/animatecss_block/src/Service/AnimateCssBlockHelperService.php on line 248\n[{"command":"settings","settings":{"ajaxPageState":{"theme":"vartheme_claro","theme_token":"aUVtYr7GmL5_ALCKifq0yPq-GSLeEKPAdQWjPDSSF28","libraries":"eJx9U1GWpCAMvBDqGfYkvoBpzWskPhLdnT39RlSmnd6ZHyFVRSRFAsNMqVfm6CF359pqRnTwLdVOvGGmpJj0LiurVDEFTg4SzaAYRHofOTy7E2hK9EqvVLkwpGbAzXka-4UW7K6NO3IMeV0gtkeKd6gtt3JhYsHUHUvr8XEhp_aITrCP5C-p3caFCJkvZYKtUfCG8uOBWBOUyEDz4o-uED-JC2kipaf8LDn9MlGuqSEobVhO3_DAMcIieAOHzItfVc3uV3iGMFHCJsF814uayXKDrLqIE8KA-R3PKAsnsQvdOOsCpbAXcFhjTOI8Q6S_6Oz50Irdv7VATBtlTrM1Tk9psLPK-cr2X9KZRbsHVXSETlCV0ii9ZvioZb2CTibOGlat7Bk74UAQ-xkHgr48T_cOtTqhuab8tH4pX_d1FlACLPirtJqy2vn9TTPHToMB66…', name: "AjaxError", stack: "@https://mtcbenin.lndo.site/core/misc/ajax.js?v=10.3.3:196:32\n@https://mtcbenin.lndo.site/core/misc/ajax.js?v=10.3.3:1921:3\n" }

Steps to reproduce

- Enable the module.
- From Block layout page try to place a new block to any region

Proposed resolution

Reading another similar issue on paragraph i am not expert but try imitating the patch they provided here πŸ› Deprecated function: strtr(): Passing null to parameter #1 ($string) of type string is deprecated in paragraphs_theme_suggestions_paragraph() Postponed: needs info . i attach my imitated patch here

Remaining tasks

- Maintainer confirm it's the correct solution
- Test and review for the patch

πŸ› Bug report
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡§πŸ‡―Benin delacosta456

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @delacosta456
  • I applied this patch(passing_null_deprecated.patch), and it worked for me. the issue has been resolved. I have also attached a screenshot.

  • πŸ‡§πŸ‡―Benin delacosta456

    hi @ananyak
    Thanks for testing ..
    Let us wait for the maintainer's test.

    How ever i also noticed that when the module is enable and this bug around together with the patch, hitting the "Save Blocks" button under all blocks at structure/block/list returned an error Fatal error: Allowed memory size of 536870912 bytes exhausted ..
    Maybe the maintainer will also help for this

    Thanks

  • Assigned to mahyarss
  • Status changed to Needs review 5 months ago
  • πŸ‡΅πŸ‡±Poland mahyarss

    Hi @delacosta456, @ananya.k,

    Thanks for your efforts in testing and reporting! Based on the previous feedback, I’ve made further improvements to address the deprecated warning when passing null to the `strtr()` function. In addition, I've thoroughly tested the patch to ensure that it resolves the "memory exhausted" error that was also occurring with the previous patch.

    Could you please test it again on your end and let me know if it resolves both issues?

  • πŸ‡΅πŸ‡±Poland mahyarss

    I had been waiting for feedback on the previous patch, but since I haven’t received a response, I took the initiative to personally test the patch in various scenarios. Based on my testing, the issue appears to be resolved.

    Additionally, I have released the latest version of the module, which includes the fixes and improvements. You can now use the updated version.

  • πŸ‡΅πŸ‡±Poland mahyarss

    If you encounter any further issues or have additional questions, feel free to reach out, and I will be happy to assist you.

    Thank you for your contributions and feedback!

Production build 0.71.5 2024