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.
Running i18n-7x-1.10 i got some fatal errors
PHP Fatal error: Call to undefined method i18n_object_wrapper::strings_update() in /sites/all/modules/contrib/i18n/i18n_string/i18n_string.module
on line 851
Inspecting the code i see i18n_object_wrapper does not got the named method.
Comment | File | Size | Author |
---|---|---|---|
#54 | i18n-fatal-error-undefined-strings_update-2082573-54.patch | 1.04 KB | jyraya |
#52 | i18n-2082573-52-fatal.patch | 1.05 KB | pio.fernandes |
#49 | i18n-2082573-49-fatal.patch | 1 KB | jadsay |
#40 | i18n-2082573-40-fatal.patch | 1.45 KB | geek-merlin |
Comments
Comment #1
Sylvain_G CreditAttribution: Sylvain_G commentedDoing more debugging
i18n_string.module
function i18n_object returns an instance of i18n_object_wrapper instead of i18n_string_object_wrapper
Cannot figure ou why ;-(
Comment #2
Sylvain_G CreditAttribution: Sylvain_G commentedDamn this is tricky
here is my enabled modules on Drupal 7.23
(tried, update to 1.9, nothing better)
i found out
I'm running
With APC
so $info is empty after module_invoke_all()
Comment #3
Sylvain_G CreditAttribution: Sylvain_G commentedOK, i figured out!!
Not a i18n bug
I applied a core patch that causes issues
Do NOT APPLY https://drupal.org/node/1978592#comment-7810477
Comment #4
Soul88Sylvain_G, can you please specify when this error appeared? During installation/clearing caches/common use of site/...?
Comment #5
Sylvain_G CreditAttribution: Sylvain_G commentedAfter applying the patch on a preinstalled i18n module
After clearing cache, module_invoke_all() works properly, but later it is no more the case... it may be a side effect from the patch + apc
cheers
Comment #6
timaholt CreditAttribution: timaholt commentedI'm not using this core patch but still have this error. Trying to track it down now. @Sylvain_G, are you also using rules_i18n?
Comment #7
tondeuse CreditAttribution: tondeuse commentedStill an issue for me, Drupal 7.26, i18n version = "7.x-1.11", here is the list of the dependencies in my installation profile.
Core is not patched.
Comment #8
Sylvain_G CreditAttribution: Sylvain_G commented@timahold nope i do not use rules_i18n but my issue was related to performances patches i installed.
If it works ok one time after a clear cache it is cache related.
Do you use APC user space to cache things? try with no cache
Comment #9
generalconsensus CreditAttribution: generalconsensus commentedMore information on this bug. I was getting issues with this when I was using Drupal 7.28 as opposed to Drupal 7.29. Upgrade to Drupal 7.29 fixed this issue for me. My error was similar but the method it was looking for was strings_remove. More below:
Call to undefined method i18n_object_wrapper::strings_remove()
Comment #10
saltednutWe are seeing this during UI-based installations of our profile. Using latest i18n and Drupal 7.34
Drush-based (
drush si
) installations are not affected.Comment #11
saltednutThis patch should prevent errors but I don't know enough about i18n_string to determine if this is a real fix or merely a work-around.
Comment #12
Rajab Natshah CreditAttribution: Rajab Natshah commentedWe do still have this issue for i18n 7.x-1.11 !!
Comment #13
yce CreditAttribution: yce commentedI had add some more conditions to make sure we get the correct objects/values.
And there is a rules_i18n part to it, I've attached it to the related issue.
Related issue: https://www.drupal.org/node/2410729
Comment #15
yce CreditAttribution: yce commentedComment #16
omarlopesinoThe patch worked for me. Thanks.
Comment #17
rodrigoaguileraWorked for me too.
I tested it manually and reviewed the code and everything looks ok.
Comment #18
Jose Reyero CreditAttribution: Jose Reyero commentedThis may work but I think the patch just hides the error, not really fixing it. The question is why are we getting an invalid object there in the first place?
Some more background on the issue:
- i18n_object() should get back some wrapper for objects handled/translated by i18n/i18n_strings
- For objects having associated 'textgroups', that is the ones that should be able to use i18n_strings API, those have a strings_update() method and some others.
- it seems in this case i18n_strings is used on objects that don't define the proper i18n API and this should never be the case.
I know the code is somehow lacking and the proper way to do this is maybe using some interfaces, etc.. However the question here is: why are we invoking i18n_strings' methods on objects that don't support them? which kind of objects are those?
Or maybe.. is it happening only on installs because such object is not defined yet? (then defaulting to i18n_object_wrapper which doesn't implement these strings callbacks)
So, once we understand the issue, ok to some workaround but otherwise we may be just hiding a bug somewhere else.
Comment #19
saltednut100% agree as the original author of the patch. I simply wrote it to work around and I needed a place to upload the patch so I could include it in a make file.
Comment #20
Jose Reyero CreditAttribution: Jose Reyero commentedThis may be related to #1681414: Enabling i18n modules fail in install profile
Comment #21
omarlopesinoThe problem that i had before applying the patch happened when i updated a module (using drush) who needed do translations. Could the calling of the function fails because the Drupal bootstrap it's not executed?
Comment #22
lsolesen CreditAttribution: lsolesen commentedTrying to apply #13:
Comment #24
rodrigoaguilera@lsolesen according to the test it applies to 7.x-1.11
It should apply to the dev version
Comment #26
axe312 CreditAttribution: axe312 commentedPatch worked. PLEASE commit. This breaks the whole update queue, I could not do any drush updb...
Comment #27
timlie CreditAttribution: timlie commentedPatch works for me too!
Comment #28
lsolesen CreditAttribution: lsolesen commentedAs mentioned in #5 I was able to upgrade after clearning my caches, so it might be a caching issue?
Comment #29
axe312 CreditAttribution: axe312 commented@Isolesen: Also cleared my caches and it did not help me. I had to apply the patch.
Comment #30
timlie CreditAttribution: timlie commentedSame for me. No caching problem...
Comment #31
Jose Reyero CreditAttribution: Jose Reyero commented@axe312,
Please do read the thread, specially #18 and #19 before moving this to RTBC..
I mean, absolutely NOT RTBC
Comment #32
stmh CreditAttribution: stmh commentedI am getting the same error in one of my update_hooks when I run the update from drush. If I run the same update vie web-browser it works. My update-function looks like this:
Maybe this helps to narrow down the problem.
Comment #33
robertragas CreditAttribution: robertragas commentedPatch works for me.
Some things I found out.
I have tested it on two environments. 1 Staging and 1 local in a vagrant box.
The staging had no problem even without the patch, but the vagrant one needed the patch. Maybe it has something to do with server configuration?
Comment #34
Garrett Albright CreditAttribution: Garrett Albright as a volunteer commentedPatch saves the day for me too. In my case, I was getting this error persistently after running a hook_update_N() which deleted a View which had a page display with a menu link.
Comment #35
ddease2 CreditAttribution: ddease2 commentedPatch worked for me also.
Comment #36
patrick.thurmond@gmail.comI had this error after I pulled a production database down to my local to study a problem. Turns out I just need to run "drush cc all". That fixed the problem.
Comment #37
pradeep_0306 CreditAttribution: pradeep_0306 as a volunteer commentedi am tried including patch files but no use its still throwing same error can any one help in this case i am tring to install through drush
where iam geting this error
Comment #38
pradeep_0306 CreditAttribution: pradeep_0306 commentedtrying to apply #13 its showing this error
error: patch failed: i18n_string.module:860
error: i18n_string.module: patch does not apply
Comment #39
geek-merlinI have a gut feeling about this. What if several modules are enabled but the static i18n_object_info() cache is outdated then. Clearing it in hook_modules_enabled would help then.
EDIT: this is exactly what is currently done. ;-)
Comment #40
geek-merlinYes my gut feeling was right, but this was way more complicated and the hardest debugging i can remember.
Patch flying in that clears all necessary static cachings.
Comment #41
bramvandenbulcke CreditAttribution: bramvandenbulcke commentedI had this error on two multilingual websites with i18n version 1.13. It's pretty nasty because it gives a WSOD.
Strangely, I could avoid the error by updating the contrib modules in the interface and updating drupal with drush up drupal.
Comment #42
fuerst CreditAttribution: fuerst commentedPatch in #40 did not help when calling
menu_link_delete()
insidehook_update_N()
.Although clearing cache (
drush cc all
) before did.Comment #43
Jose Reyero CreditAttribution: Jose Reyero at Axel Springer España commentedThe idea in patch #40 looks good to me.
Actually the solution should be this core patch, but it may take time so we can commit something in the meanwhile, #1891356: D7: Reset drupal static caches when a module is enabled or disabled.
Could we get the same with less code, adding the i18n_object_info_cache_clear() call inside i18n_string_refresh_enabled_modules() (i18n_string.admin.inc?)
About the menu item issue (#42), it may be a different problem, maybe coming form i18n_menu_menu_link_delete().
If someone could post a full backtrace instead of only the error message....
Comment #44
aspilicious CreditAttribution: aspilicious commentedNot working...
#13 is the only patch that helps to unblock our automated upgrade paths.
Comment #45
fuerst CreditAttribution: fuerst commentedHere is a backtrace after calling
_og_menu_default_links_set_default_links()
from insidehook_update_N()
:Workaround here is to call
drush_cache_command_clear('all')
before_og_menu_default_links_set_default_links()
.Comment #46
drasgardian CreditAttribution: drasgardian at Eighty Options commentedMight be some help to others finding this issue...
I was encountering the above error message while installing from a custom profile but none of the above workarounds using drupal_static_reset were helping. I debugged the i18n_object and found that it was related to webforms, but I didn't have the webform module enabled! Eventually I found that I had a feature that defined some field_bases and field_instances on the webform bundle, but that feature was missing 'dependencies[] = webform' from its .info file. After I added the dependency the error went away.
Comment #47
Kristen PolI get a similar error which might be related:
Running
drush cc all
does not fix this but runningdrush rr
does.The code that causes this is an update hook similar to this (needs the my_vocab vocabulary this case):
After running the
drush updb
, the fatal error shows up when I do other things (e.g.drush cc all
). Once I rundrush rr
, it sorts itself out and then I don't get the fatal error anymore. Note that the patch from #40 did not fix my problem but I'm not enabling/disabling a module. It is a Features module that gets reverted so I assume it has something to do with that.Comment #48
francescjr CreditAttribution: francescjr commentedThe only thing that worked for me to enable a module (feature) that was editing custom menu_links was patch #13. The error was firing at
menu_link_save($mod_link);
And nor patch #40 nor clearing cache worked. What always worked, without any patch was enabling the feature for second time. Since the feature had all the i18n dependencies, they got installed at the same time. But if they were already installed, it looks that I could avoid this error.
Comment #49
jadsay CreditAttribution: jadsay commentedThis patch is for version 1.12 of the module
Comment #50
Jose Reyero CreditAttribution: Jose Reyero at ESCR-Net commentedFound this error too, not sure about the ultimate cause but I think it was adding fields through features, using features-revert-all...
Anyway, cleaned up the error by running: drush cc registry
Then drush cc all, etc... error gone.
Comment #51
Shiraz Dindardrush rr fixed it for me.
Comment #52
pio.fernandes CreditAttribution: pio.fernandes commentedThis patch is for version 1.13 of the module
Comment #53
jyraya CreditAttribution: jyraya at European Commission and European Union Institutions, Agencies and Bodies commentedHello,
I made a small correction in the previous patch.
There was still the old
drupal_static_reset('i18n_object_info');
ini18n_modules_enabled()
.The patch is applicable on the version 1.13 and the current dev version.
@Jose Reyero,
From your last comment, can I conclude that the logic as implemented in the patches since #40 did not work for you?
Comment #54
jyraya CreditAttribution: jyraya at European Commission and European Union Institutions, Agencies and Bodies commentedOops, I forgot to attach the patch to my previous ticket.
Comment #55
ybabel CreditAttribution: ybabel commentedPatch working for me