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.
Like it says in the title.
I am trying to analyse performance on the home page of a site, and have noticed this error string being output in the content of a cached js file. E.g. the contents of js_a89adsd9f0d9d0adaddsfd987 (or whatever) is the above PHP error message.
Comment | File | Size | Author |
---|---|---|---|
#16 | devel-644716-16.patch | 624 bytes | gapple |
Comments
Comment #1
srobert72 CreditAttribution: srobert72 commentedSubscribing. I have same error.
Comment #2
Leo Pitt CreditAttribution: Leo Pitt commentedA bit of additional info on my bug. The problem was intermittent, mostly the js file would be okay, but occasionally, maybe 1 in four times (if I remember correctly) this error would occur.
Comment #3
henrrrik CreditAttribution: henrrrik commentedThis pops up in our error logs too. RHEL5 box running PHP 5.1.6.
Comment #4
davividal CreditAttribution: davividal commentedSame problem here.
I'm using normal cache option and if I clear the cache, the error is gone in the first page access. After that, the problem comes back.
Comment #5
huntsinger CreditAttribution: huntsinger commentedSame problem here. Its strange because sometimes the t() function is there and sometimes it isn't. If I add the t() function to performance.module it will work for a time and the problem goes away. Wait a little while and then we get the error, cannot redeclare funtion t()
Devel is up to date - Devel 6.x-1.18
from apache2 error.log
[Tue Dec 22 10:42:13 2009] [error] [client ] PHP Fatal error: Call to undefined function t() in /sites/all/modules/devel/performance/performance.module on line 167
Comment #6
kostajh CreditAttribution: kostajh commentedSame problem here.
Additionally, I only see the error message on the home page of the site when using Chrome or IE 7, but not with Safari and Firefox.
Comment #7
viridisweb CreditAttribution: viridisweb commentedSame problem here. For me it happens on home page and also when using the autocomplete on a finder form.
Additionally, it seems to only happen when cache is on.
Comment #8
gappleAs noted in the documentation for common.inc, where t() is defined:
Therefore t() is never defined for cached pages, as it is assumed that any cached pages have everything to be output already translated.
The simplest solution would be to remove the t() calls; I don't think 'Yes' and 'No' are a priority to translate, especially for developers.
Otherwise, a check if t() is defined could be used to create a dummy function, which seems excessive for just two calls
or run the same line of code without t()
However, I could foresee some people getting confused if their output mysteriously changes from translated to untranslated, so would think consistently untranslated would be the best option.
Comment #9
RAFA3L CreditAttribution: RAFA3L commentedSame problem here...
Comment #10
dogbertdp CreditAttribution: dogbertdp commentedI've encountered this issue as well.
subscribing
Comment #11
dicreat CreditAttribution: dicreat commentedsubscribing
Comment #12
Chris Einkauf CreditAttribution: Chris Einkauf commentedsubscribing
Comment #13
Leo Pitt CreditAttribution: Leo Pitt commented@gapple #8
That seems like a pretty sensible solution to me, in the short term at least.
One suggestion, why not pass a value that is language-independent. E.g. Pass a simple boolean "1" / "0", or "TRUE" / "FALSE" instead of "Yes" / "No"?
Any functions which test the value can then use t() to output a human-readable string.
It seems to me that the fundamental problem is that the flag is being treated as output for human eyes, when really it's programming flag..
Make sense?
Comment #14
Leo Pitt CreditAttribution: Leo Pitt commentedSorry, double post, see above.
Comment #15
kbahey CreditAttribution: kbahey commentedCan someone create a real patch, so others can apply and review?
Comment #16
gappleHere's the simplest patch to just remove
t()
callsComment #17
kbahey CreditAttribution: kbahey commentedThanks, I committed this patch to both the 6.x and 7.x -dev branches.
Comment #18
davividal CreditAttribution: davividal commentedAfter *much* tests, it turns out that it seems that I was using cache 2 times: Drupal-side and server (lighttpd) side.
So, I was getting a page compressed 2 times, but my browser only decompressed it 1 time.
Disabling Drupal cache solved this issue for me.