Skip to content

Conversation

@ergohack
Copy link
Contributor

Description (*)

When the Global Default website icons are deleted, in favor of the store website icons, a NULL parameter is passed to Escaper.php and the site will crash.

Adding a sanity check avoids the crash.

[2024-12-20T17:21:42.186669+00:00] main.CRITICAL: TypeError: addslashes(): Argument #1 ($string) must be of type string, null given in /home/jetrails/encircle.markets/html/vendor/magento/framework/Escaper.php:440
Stack trace:
#0 /home/jetrails/encircle.markets/html/vendor/magento/framework/Escaper.php(440): addslashes(NULL)
#1 /home/jetrails/encircle.markets/html/vendor/magento/module-theme/Block/Html/Header.php(62): Magento\Framework\Escaper->escapeQuote(NULL, true)
#2 /home/jetrails/encircle.markets/html/vendor/magento/module-theme/view/frontend/templates/html/header.phtml(11): Magento\Theme\Block\Html\Header->getWelcome()

Related Pull Requests

n/a

Fixed Issues (if relevant)

n/a

Manual testing scenarios (*)

  1. (optional) add at least one more website to Stores | Configurations ./admin/system_store/index/key/…
  2. remove the default global website icons
  3. Content | Design/Configuration ./theme/design_config/index/key/…
  4. Edit the first, Global line, listed without a website.
  5. delete the Favicon and default page title in the [HTML Head] section
  6. delete the Logo Image and Welcome Text in the [Header] section
  7. (optional) delete the Logo Image from the [Transactional Emails] section
  8. Add the Favicon, page title, Logo Image and Welcome Text to the second line with an actual website.
  9. (optional) Add the Favicon, page title, Logo Image and Welcome Text to the subsequent line with the second website.
  10. restart the site, reload the home page [BOOM] (stack trace above)

Questions or comments

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)
  • [ - ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ - ] All automated tests passed successfully (all builds are green)

ergohack and others added 13 commits June 3, 2024 10:10
misuse of API, ... When `true`, the resultant getData(..,true) call shifts the context to the specified field, expecting it to be an array.  The previous Data context is replaced.  In this case, the field is not an array and all of the previous data on this object now returns NULL.  I don't believe loss of this, and all of the other fields was the intended behavior.
During updates, especially when modules are being removed, some configuration vestiges will cause the `bin/magento setup:upgrade` to fail here, because they are actually missing and cannot be loaded.

This is primarily a convenience to the developer, … with this change  the configuration vestiges are cleaned up once the `bin/magento setup:upgrade` completes.  Without it, the `bin/magento setup:upgrade` fails to start.
During updates, especially when modules are being removed, some configuration vestiges will cause the `bin/magento setup:upgrade` to fail, because they are actually missing and cannot be loaded.

This is primarily a convenience to the developer, … with this change the configuration vestiges, that are cleaned up once the bin/magento setup:upgrade completes are able to run to completion.  Without it, the `bin/magento setup:upgrade` fails to start.
The virtual type configurations are not supposed to be self‑referential, … but if they ever are this function will spin in an infinite loop.
avoid a misconfiguration infinite loop
Dev convenience when a removed module blocks `bin/magento setup:upgrade`
misuse of API … call with `true` deletes this object's data
@m2-assistant
Copy link

m2-assistant bot commented Dec 20, 2024

Hi @ergohack. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@ergohack ergohack closed this Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant