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

TypeError: explode(): Argument #2 ($string) must be of type string, null given in /var/www/php/folder/vendor/magento/module-config/ViewModel/CountryFilter.php:46 #35901

Closed
1 of 5 tasks
pmonosolo opened this issue Aug 9, 2022 · 22 comments
Labels
Area: Framework 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 Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@pmonosolo
Copy link

pmonosolo commented Aug 9, 2022

Preconditions and environment

  • Magento version - 2.4.5 CE
  • Visit Stores -> Configuration and see error
  • Error reporting turned on
  • Page shows an error
  • PHP 8.1.9

Steps to reproduce

  1. Login into Admin Site
  2. Go to Stores->Configuration

Expected result

Configuration page visible

Actual result

Error is thrown:

TypeError: explode(): Argument #2 ($string) must be of type string, null given in /var/www/php/folder/vendor/magento/module-config/ViewModel/CountryFilter.php:46
Stack trace:
#0 /var/www/php/folder/vendor/magento/module-config/ViewModel/CountryFilter.php(46): explode(',', NULL)
#1 /var/www/php/folder/vendor/magento/module-config/view/adminhtml/templates/system/config/js.phtml(81): Magento\Config\ViewModel\CountryFilter->getEuCountryList()
#2 /var/www/php/folder/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/var/www/php/mo...')
#3 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Backend\Block\Template), '/var/www/php/mo...', Array)
#4 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callParent('render', Array)
#5 /var/www/php/folder/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\TemplateEngine\Php\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Backend\Block\Template), '/var/www/php/mo...', Array)
#6 /var/www/php/folder/generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php(23): Magento\Framework\View\TemplateEngine\Php\Interceptor->___callPlugins('render', Array, Array)
#7 /var/www/php/folder/vendor/magento/framework/View/Element/Template.php(263): Magento\Framework\View\TemplateEngine\Php\Interceptor->render(Object(Magento\Backend\Block\Template), '/var/www/php/mo...', Array)
#8 /var/www/php/folder/vendor/magento/framework/View/Element/Template.php(293): Magento\Framework\View\Element\Template->fetchView('/var/www/php/mo...')
#9 /var/www/php/folder/vendor/magento/module-backend/Block/Template.php(141): Magento\Framework\View\Element\Template->_toHtml()
#10 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(1095): Magento\Backend\Block\Template->_toHtml()
#11 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element{closure}()
#12 /var/www/php/folder/vendor/magento/framework/View/Element/AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#13 /var/www/php/folder/vendor/magento/framework/View/Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml()
#14 /var/www/php/folder/vendor/magento/framework/View/Layout.php(555): Magento\Framework\View\Layout->_renderBlock('js.system_confi...')
#15 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->renderNonCachedElement('js.system_confi...')
#16 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('js.system_confi...')
#17 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('js.system_confi...', false)
#18 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('js', false)
#19 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->renderNonCachedElement('js')
#20 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('js')
#21 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('js', false)
#22 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('page.wrapper', false)
#23 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#24 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#25 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('page.wrapper', false)
#26 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('backend.page', false)
#27 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->renderNonCachedElement('backend.page')
#28 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page')
#29 /var/www/php/folder/vendor/magento/framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement('backend.page', false)
#30 /var/www/php/folder/vendor/magento/framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer('root', false)
#31 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->renderNonCachedElement('root')
#32 /var/www/php/folder/vendor/magento/framework/View/Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#33 /var/www/php/folder/vendor/magento/framework/View/Layout.php(975): Magento\Framework\View\Layout->renderElement('root')
#34 /var/www/php/folder/generated/code/Magento/Framework/View/Layout/Interceptor.php(50): Magento\Framework\View\Layout->getOutput()
#35 /var/www/php/folder/vendor/magento/framework/View/Result/Page.php(260): Magento\Framework\View\Layout\Interceptor->getOutput()
#36 /var/www/php/folder/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#37 /var/www/php/folder/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(32): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#38 /var/www/php/folder/vendor/magento/framework/App/Http.php(120): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#39 /var/www/php/folder/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#40 /var/www/php/folder/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#41 {main}

Additional information

No response

Release note

No response

Triage and priority

  • 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.
  • 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-assistant
Copy link

m2-assistant bot commented Aug 9, 2022

Hi @pmonosolo. 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.


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

🕙 You can find the schedule on the Magento Community Calendar page.

📞 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.

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

@pmonosolo
Copy link
Author

The code responsible is this:

image

I wonder if the list was not generated or something during the upgrade?

I've tried flushing cache and disabling it completely.

@engcom-November engcom-November self-assigned this Aug 10, 2022
@m2-assistant
Copy link

m2-assistant bot commented Aug 10, 2022

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: 👇

  • 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.

@jorgb90
Copy link

jorgb90 commented Aug 10, 2022

Running 2.4.5 on PHP 8.1 here and not having this issue. Perhaps some external module is altering this list?

@pmonosolo
Copy link
Author

Running 2.4.5 on PHP 8.1 here and not having this issue. Perhaps some external module is altering this list?

Hmmm, not sure yet. Just starting to dig into this again.

So far I have:
rm -rf vendor/*

Then upgraded composer to v2 and reinstalled everything. Still getting the same error.

Found mentions of CountryFilter in two plugins:

vendor/webshopapps/module-matrixrate/src/Model/ResourceModel/Carrier/Matrixrate/Collection.php:    public function setCountryFilter($countryId)
vendor/mageside/canada-post-shipping/Model/Source/Province.php:        $this->addCountryFilter('CA');
vendor/mageside/canada-post-shipping/Model/Service/Postoffice.php:            $collection->addCountryFilter('CA')->load();

Going to try to go around them or deinstall. Will report back.

@pmonosolo
Copy link
Author

pmonosolo commented Aug 10, 2022

Disabling / removing those two plugins did not work.

I assume this is a data problem - something broke when initial upgrade script ran (did not finish successfully on first try).

Going to try uploading new backup of DB and re-running the upgrade command.

@pmonosolo
Copy link
Author

Could it be related to: #35875
?

@pmonosolo
Copy link
Author

pmonosolo commented Aug 10, 2022

Hmmm same error after redoing upgrade command on new DB backup.

Must be something else.

Tried this:

image

And the page pulled up right away.

@pmonosolo
Copy link
Author

pmonosolo commented Aug 10, 2022

Checked the DB:

image

Looks like the values are empty. Are they supposed to be any other way?

On Magento 2.4.3 site in production now, these values are unchecked (no countries chosen):

image

And "Use system value" is unchecked.

@pmonosolo
Copy link
Author

pmonosolo commented Aug 10, 2022

After doing this:

image

Then going to General -> Countries -> European Union Countries -> Clicking "Use system value"

Then undoing the code back to initial state:

image

The page now shows up correctly:

image

Then when I rerun the MySQL query for same field:

image

It shows 0 results.

So it must be that when no EU countries are selected, it created the field with NULL, but then NULL is not accepted by the code.

@pmonosolo
Copy link
Author

I think this was a bug somewhere in 2.4.3, or in the earlier version of Magento 2.3.3 which the site went through that the values were not defaulted when you uncheck them and uncheck "Use system value".

Now on 2.4.5 when you uncheck the "Use System Value" it defaults the fields to:

image

If you uncheck all those countries and save again, it puts them back in.

UPDATE:
Yes, confirmed 2.4.3 does not default the values, it nulls them when "Use System Value" is unchecked.

When 2.4.5 upgrade happens it expects the value not to be NULL, thats where the issue is coming from.

@engcom-November engcom-November added the Reported on 2.4.5 Indicates original Magento version for the Issue report. label Aug 11, 2022
@engcom-November
Copy link
Contributor

Hi @pmonosolo ,
Thank you for reporting and collaboration. Verified the issue by upgrading from 2.4.3 to 2.4.5 in production mode but could not able to reproduce the issue.
Kindly elaborate the steps / configuration details or any other modules enabled if any is causing the issue.
Thank you.

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label Aug 11, 2022
@engcom-November engcom-November added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Aug 11, 2022
@sidolov sidolov added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Framework labels Aug 11, 2022
@m2-community-project m2-community-project bot removed the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Aug 11, 2022
@sidolov sidolov added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Aug 11, 2022
@m2-community-project m2-community-project bot removed the Issue: needs update Additional information is require, waiting for response label Aug 11, 2022
@sidolov sidolov removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Aug 11, 2022
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue Progress: dev in progress and removed Progress: dev in progress labels Aug 22, 2022
@m2-community-project m2-community-project bot removed the Progress: PR Created Indicates that Pull Request has been created to fix issue label Aug 23, 2022
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels Aug 25, 2022
@engcom-November engcom-November removed their assignment Sep 1, 2022
@m2-community-project m2-community-project bot added Progress: ready for dev and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Sep 1, 2022
@rogerdz
Copy link
Contributor

rogerdz commented Sep 14, 2022

It was fixed in commit 29f0658

@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Sep 14, 2022

Hello,

As I can 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.

Thanks

@davirs
Copy link

davirs commented Nov 21, 2023

@engcom-Hotel
I updated my magento 2.4.4 to 2.4.6-p3 and this error persists.
I checked the files within the latest commit AC-6385 and they are present in version 2.4.6-p3.
Is there any provision for merging this commit?

@engcom-Hotel
Copy link
Contributor

Sure @davirs, let us check, we will get back to you.

@webcreative24
Copy link

@engcom-Hotel Same here after update from 2.4.2 to 2.4.6-p3

@webcreative24
Copy link

Here is the solution:
find in your DB
SELECT * FROM core_config_data WHERE path = 'general'
and then remove these records from the DB. clear cache - enjoy

@ingmarnet
Copy link

ingmarnet commented Apr 11, 2024

And 2.4.7 same issue. Its not soo hard to fix it. Magento Dev needs to be more faster to fix that problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework 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 Reported on 2.4.5 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.