Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Really annoying bug, took me a while to figure out that countries_i18n is the cause. It was tough to figure out as this module was not related to test in question at all. So countries_i18n was not a dependency to any of the tested modules but by having the module enabled in the parent installation caused the errors. Disabling module before running tests prevents these errors.
The error
WD system: i18n_string module installed. [10.92 sec, 85.81 MB]
PHP Fatal error: Call to undefined method i18n_object_wrapper::strings_update() in /.../sites/all/modules/i18n/i18n_string/i18n_string.module on line 851
Drush command terminated abnormally due to an unrecoverable error.
Important pieces of the xdebug output
PHP Stack trace:
...
PHP 20. i18n_string_refresh_enabled_modules() /.../sites/all/modules/i18n/i18n_string/i18n_string.module:208
PHP 21. module_invoke() /.../sites/all/modules/i18n/i18n_string/i18n_string.admin.inc:184
PHP 22. call_user_func_array() /.../includes/module.inc:833
PHP 23. countries_i18n_string_refresh() /.../includes/module.inc:833
PHP 24. i18n_string_object_update() /.../sites/all/modules/countries/modules/countries_i18n/countries_i18n.module:100
Drush command terminated abnormally due to an unrecoverable error.
Error: Call to undefined method i18n_object_wrapper::strings_update() in /.../sites/all/modules/i18n/i18n_string/i18n_string.module, line 853 [8.21 sec, 108.52 MB]
I've also attached a patch that should make testbot show these same errors.
Comment | File | Size | Author |
---|---|---|---|
#4 | countries_i18n.diff | 911 bytes | sammuell |
countries_i18n_tests_failure.patch | 407 bytes | mikran | |
Comments
Comment #1
mikran CreditAttribution: mikran commentedOh that was unexpected pass from the testbot. I've tested this again and the steps to reproduce on fresh install are:
1. enable countries_i18n
2. run any test that enables countries and i18n_string -modules
And now, I have no clue how to create a test that tests aforementioned conditions. Test inside a test?
EDIT: added countries to step 2.
Comment #2
Alan D. CreditAttribution: Alan D. commentedUm, how was countries_i18n enabled without countries or i18n_string!? Also the test you just ran, runs off a clean setup, so everything would be disabled until a test enables it. Unless you are doing something outside of the norm?
There are no statics or any else that is suspect in the sub-module that I can see, so I'm temped to push this into the i18n queues for feedback, although maybe answers to the above two questions may shed some light on this.
PS: Assume that there is a cache issue in the i18n suite somewhere, so flush out the caches if you are disabling modules, then re-enabling modules within a single test. If that fails, try a class registry flush too, or separate tests into individual test cases.
Comment #3
mikran CreditAttribution: mikran commentedDependencies are enabled normally, I just assumed that would happen when doing the step 1.
I'm doing this
I think the problem would go away if i18n hooks were implemented right in the countries module and not in a separate sub module.
Related issues I found:
#2082573: PHP Fatal Error Call to undefined method i18n_object_wrapper::strings_update(): I think the resolution here is a bit work-around'ish, could be same issue
#1697384: Call to undefined method i18n_object_wrapper::strings_update(): This is fixed and already included in the latest version
Comment #4
sammuell CreditAttribution: sammuell commentedThe culprit is the function countries_i18n_string_refresh() which is defined as a 'refresh callback'.
Firstly, this refresh callback option does not seem to exist anymore on D7. I think it's a leftover from D6.
Secondly, I think it's misnamed, because it's implementing the hook 'i18n_string_refresh' on behalf of the countries module. The entity hooks of the countries_i18n module are not yet defined at this moment, hence the fatal error.
Renaming the function to countries_i18n_i18n_string_refresh() solves the error.
Comment #5
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedGreat catch. Thanks @sammuell
Comment #8
ennorehling CreditAttribution: ennorehling as a volunteer and at Servebolt.com commentedExecellent work, @sammuell - many thanks!