When site caching is enabled I get - Fatal error: Call to undefined function t()

NITEMAN - May 15, 2009 - 10:02
Project:Hide submit button
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Optalgin
Status:active
Description

I've recently installed this module and about a half of users are getting the abobe error. I guess it could be a chache related issue.

Best regards

#1

Optalgin - May 15, 2009 - 10:28
Assigned to:Anonymous» Optalgin

This was reported before here:
#393558: Fatal error in opera and safari

I'll continue the discussion here since the title of this issue describe the problem better

#2

pribeh - May 15, 2009 - 14:41

Thanks Nir.

#3

NITEMAN - May 15, 2009 - 17:37

Our users report the error in firefox and chrome also.

I've only reproduced this issue when loggin in the site (with internet explorer 8 this time), my test site this time ;).

I guess this issue is related with drupal caching, we use standard 5.x caching system + memcached on our site (also a manual pach form 2bits.com).

It seems module is called before drupal bootstrap, changing module's weight doesn't fix the issue.

We are available to do further testing if there is any patch.

5.x-1.0-beta1 is also affected by this one.

Best regards

#4

Optalgin - May 16, 2009 - 20:23
Status:active» needs review

Okay,

I think I solved it, but couldn't reproduce and test it on my test server.

The fix was committed into the latest dev. release, please test it

Thanks

* Note: For some reason the date for this release is 'March 1, 2009' but the new files are there

#5

pribeh - May 16, 2009 - 22:02

Testing...

#6

NITEMAN - May 17, 2009 - 10:58
Status:needs review» needs work

The error has changed.

Now I'm getting this:

Fatal error: Call to undefined function drupal_get_path_alias() in /.../sites/all/modules/hide_submit/hide_submit.module on line 215

I think you are in the right way.

Best regards.

#7

NITEMAN - May 17, 2009 - 11:07

I've found an error in my first follow up.

I say I've reproduced the issue when loggin in IE8, but it was when loggin off.

#8

pribeh - May 17, 2009 - 15:04

Haven't experienced anything in either FF or Safari.

#9

Optalgin - May 17, 2009 - 15:46

Okay..

Apparently drupal_get_path_alias is not loaded for cached pages

Can you try and modify hide_submit.module and add this line inside the hide_submit_init function and try again?

drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);

New code should look like:

<?php
function hide_submit_init() {
   
    static
$hide_submit_js_already_loaded = FALSE;

   
drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);

    if (!
$hide_submit_js_already_loaded && _hide_submit_load_js_check_condition()) {
       
$js = _hide_submit_get_javascript();

    ...
?>

I'll add it to the dev. package myself maybe later today

#10

NITEMAN - May 17, 2009 - 16:16
Status:needs work» needs review

It seems now works.

With this change maded I can't reproduce this issue in the test site with IE 8.

Right now I'm contacting with a few users to do further testing.

Good job

#11

NITEMAN - May 18, 2009 - 14:34
Status:needs review» reviewed & tested by the community

Tests passed.

As far as I know the issue is solved.

Note one side effect, deafult wait string is now the name of the variable wich stores it.

Best regards

#12

hotcom - May 24, 2009 - 13:02

Problem not fixed if Cache is on.

Added drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);

======================
function hide_submit_init() {

static $hide_submit_js_already_loaded = FALSE;

drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);

if (!$hide_submit_js_already_loaded && _hide_submit_load_js_check_condition()) {
$js = _hide_submit_get_javascript();
drupal_add_js($js, 'inline', 'footer');
$hide_submit_js_loaded = TRUE;
}
======================

Fatal error: Call to undefined function t() in /domains/xxx.com/web/modules/hide_submit/hide_submit.module on line 24

Google Chrome 1.0.154.65 and Internet Explorer 8

Seems /user causes the most problems.

Status report
Here you can find a short overview of your Drupal site's parameters as well as any problems detected with your installation. It is useful to copy/paste this information when you need support.

Drupal 5.11
CAPTCHA Already 2 blocked form submissions
Configuration file Protected
Cron maintenance tasks Last run 1 min 19 sec ago
You can run cron manually.
Database schema Up to date
File system Writable (public download method)
GD library bundled (2.0.34 compatible)
ImageCache PHP Memory Limit 64M
It is highly recommended that you set you PHP memory_limit to 96M to use imageapi_gd. A 1600x1200 images consumes ~45M of memory when decompressed and ImageAPI is often operating on two decompressed images at once.
MySQL database 5.0.77
PHP 5.2.9
PHP register globals Disabled
Unicode library PHP Mbstring Extension
Web server Apache
jQuery Update Installed correctly

Regards

#13

Optalgin - May 26, 2009 - 09:28

@hotcom, please make sure you are using the latest dev release.
I can't check right now but I think t() no longer exists in line 24 in the latest package.
The bootstrap thingy should be there as well.

10x

EDIT:
The latest dev. release "May 21, 2009 - 03:12" contains all the fixes and should fix this issue

#14

NITEMAN - May 27, 2009 - 09:13

Erratical behaviour.

We tested latest dev and put it into production site, hours later some users start to report "conection lost with server" and "timeout expired" abut once per ten times they post someting.

We have retired the module again :(

Best regards

#15

Optalgin - May 27, 2009 - 23:42

I understand that after disabling the module the "timeout expired" error goes?

I have set up a test site with caching on to try and figure this
I believe that the t() error (the original issue) was solved

This "timeout expired" error is a new issue and I am not related the the t() error
I'll open a new issue for it, but before I'll try to investigate a bit to see if I can reproduce it in my lab

#16

NITEMAN - May 29, 2009 - 09:22

Very hard to reproduce.

It seems that the timeout issue is an scalability pitfall that can be caused by any other module and hide submit only increases the frecuency of it (I've seen it in the past).

Reproducing this in lab conditions is nearly imposible even we can't reproduce it in a site's replica (because of the user concurrency of the production site). I guess this is related with database contention, but I don't understand how hide submit increases the chances of an insert been affected.

Thanks for your help.

I agree the original issue is fixed, but BE AWARE of the side effect I've mentioned in #11

Best regards

#17

Optalgin - May 29, 2009 - 21:21

I'll check #11, I guess its easier to reproduce..
Hide submit currently doesn't use any database on its own (only by using drupal functions)

I suspect that adding path functionality (the bootstrap line)
may be a possible reason for timeouts, since it is not loaded by default for cached sites
and adding it may somehow effect performance or load time

I'll try to see if I can avoid it by using other alternatives

It's a bit like shooting in the dark.. :-)

#18

hotcom - June 1, 2009 - 00:29

Updated site as per post 13

Last checked: 0 sec ago (Check manually)
Up to date
Drupal 5.18
Includes: Aggregator, Block, Contact, Filter, Menu, Node, Path, Profile, Search, Statistics, System, Taxonomy, Throttle, User, Watchdog
Up to date
Actions 5.x-2.6
Includes: Actions
Up to date
Block Cache 5.x-1.x-dev (2008-Jul-18)
Includes: Block Cache
Up to date
Calendar 5.x-2.7
Includes: Calendar
Up to date
Calendar Block 5.x-2.1
Includes: Calendar Block
Up to date
CAPTCHA 5.x-3.2
Includes: CAPTCHA
Up to date
Content Construction Kit (CCK) 5.x-1.10
Includes: Content, Fieldgroup, Node Reference, Number, Option Widgets, Text
Up to date
Computed Field 5.x-1.2
Includes: Computed Field
Up to date
Content Templates (Contemplate) 5.x-2.04
Includes: Content Templates
Up to date
Date 5.x-2.7
Includes: Date API, Date, Date Timezone
Up to date
Flag 5.x-1.1
Includes: Flag, Flag actions
Up to date
Hide submit button 5.x-1.0-beta1
Includes: Hide submit button
Up to date
ImageAPI 5.x-1.5
Includes: ImageAPI, ImageAPI GD2
Up to date
ImageCache 5.x-2.4
Includes: ImageCache, Imagecache UI
Up to date
ImageField 5.x-2.6
Includes: ImageField
Up to date
Imagefield Import 5.x-1.4
Includes: Imagefield Import
Up to date
JQuery Interface 5.x-1.0
Includes: JQuery Interface Library
Up to date
jQuery plugins 5.x-1.3
Includes: jQuery plugins
Up to date
jQuery Update 5.x-2.0
Includes: jQuery Update
Up to date
Message Effects 5.x-0.6
Includes: Message Effects
Up to date
Meta tags 5.x-1.12
Includes: Meta tags
Up to date
Panels 5.x-2.0-rc1a
Includes: Panels, Mini panels, Panel nodes, Panel pages, Panels simple cache, Views panes
Up to date
Pathauto 5.x-2.3
Includes: Pathauto
Up to date
reCAPTCHA 5.x-2.5
Includes: reCAPTCHA
Up to date
Secure Pages 5.x-1.7
Includes: Secure Pages
Up to date
Similar By Terms 5.x-1.15
Includes: Similar By Terms
Up to date
String Overrides 5.x-1.7
Includes: String Overrides
Up to date
TAPIr 5.x-1.6
Includes: Tables API
Up to date
Taxonomy Batch Operations 5.x-1.0
Includes: Taxonomy Batch Operations
Up to date
Token 5.x-1.11
Includes: Token
Up to date
Ubercart 5.x-1.7
Includes: Attribute, Cart, Cart Links, Catalog, Importer, Notify, Order, Product, Product Kit, Reports, Roles, Stock, Store, Taxes, Credit Card, Payment, Payment Method Pack, PayPal, Shipping Quotes, Shipping, Weight quote
Up to date
uBrowser 5.x-1.4
Includes: uBrowser
Up to date
Ubercart Addresses 5.x-2.1
Includes: Addresses
Up to date
Ubercart Discount Coupons 5.x-1.9
Includes: Store Coupons
Up to date
Ubercart eWay Payment Gateway 5.x-0.3
Also available: 5.x-1.x-dev (2008-Dec-28) Download · Release notes

Includes: eWAY
Up to date
UC Promotions 5.x-1.0
Includes: Promotions
Up to date
Reorder button for Ubercart 5.x-1.1
Includes: Reorder Button
Up to date
Update Status 5.x-2.3
Includes: Update status
Up to date
User registration notification 5.x-1.10
Includes: User registration notification
Up to date
Views 5.x-1.6
Includes: Views, Views UI
Up to date
Views Bulk Operations (VBO) 5.x-1.4
Includes: Views Bulk Operations
Up to date
Weather 5.x-6.3
Includes: Weather
Up to date
Workflow-ng 5.x-2.2
Includes: Workflow-ng, Workflow-ng UI

The error is only when cache is on and not constant.

Fatal error: Call to undefined function t() in /domains/xxx.com/web/modules/hide_submit/hide_submit.module on line 24

  • What would also do the job for us is a way to have a gif (Progress bar) displayed between the time the search is entered and the data is displayed so they don't think the site has crashed (We're running over 30,000 records in testing)
  • (PS it would be great to have HS work on all browsers when you hit some browsers you must click to see the replacement image..)

    Regards

    #19

    Optalgin - June 2, 2009 - 14:29

    @hotcom hi,

    Sorry for raising this again, but in your report I see that you are using the BETA release and not latest dev
    This could be an error with the report or something but I must ask you to verify again

    ...
    Hide submit button 5.x-1.0-beta1
    Includes: Hide submit button
    Up to date
    ...

    The release you should use is 5.x-1.x-dev

    The reason I believe that you are using the old code is because
    In the beta release hide_submit.module you can see the call to t() under line 24

    ...
    23 define('HIDE_SUBMIT_DEFAULT_JS_LOAD', HIDE_SUBMIT_IN_CONTENT_ADD_EDIT);
    24 define('HIDE_SUBMIT_DEFAULT_MESSAGE', t("Please wait...") );
    25
    ...

    While in the dev. release this line contains an innocent comment

    ...
    23
    24 // Default load option
    25 define('HIDE_SUBMIT_DEFAULT_JS_LOAD',      0);
    ...

    #20

    hotcom - June 6, 2009 - 05:58

    You are correct..

    I was relying upon the report from /admin/logs/updates

    Hide submit button 5.x-1.x-dev (2009-May-21)
    Recommended version: 5.x-1.0-beta1 (2009-Mar-01) Download · Release notes
    Includes: Hide submit button

    If you don't hear back you can assume it's fine now.

    PS can we have a patch so that you don't have to click on submit to see the timer gif?
    (You can use enter also)

    I note in Chrome it works with or click however in i.e. 8 you must click on submit else the submit button will disappear but without a replacement image so it looks like the page has crashed till the results appear.

    Regards

    Steve

    #21

    Optalgin - June 6, 2009 - 16:01
    Status:reviewed & tested by the community» fixed

    @hotcom,
    Regarding your request show image when enter is pressed, please open a feature request
    I'll have to investigate it a bit to get it done.

    I'm closing the current issue for now,
    If it's still not working, feel free to re-open the issue

    #22

    Optalgin - June 6, 2009 - 15:59

    @NITEMAN, regarding #11
    I raised a new issue for it.
    It is an easy fix and I'll commit it soon

    #483788: When cache is enabled, the default message is the name of the variable stores it

    I also raised a new issue regarding #15 and #16
    Hopfully I'll find a cure for it

    #483788: When cache is enabled, the default message is the name of the variable stores it

    #23

    hotcom - June 7, 2009 - 00:24
    Title:Fatal error: Call to undefined function t() in /.../sites/all/modules/hide_submit/hide_submit.module on line 24» Show image when enter is pressed.
    Category:bug report» feature request
    Status:fixed» needs work

    Hi

    It would be nice to have the gif image that hides submit working regardless of clicking on submit or hitting [Enter]/[CR]

    It seems OK on Chrome, but not working with ie8 (No change to submit button), Netscape9 (no submit button or image via click or [CR])

    PS I thought I'd put the request in the correct way.. (Seems I've changed the title on the whole thread?)

    Regards

    #24

    Optalgin - June 7, 2009 - 08:41
    Title:Show image when enter is pressed.» Fatal error: Call to undefined function t() in /.../sites/all/modules/hide_submit/hide_submit.module on line 24
    Category:feature request» bug report
    Status:needs work» fixed

    @hotcom hi

    It is better to open a new issue then changing an existing issue
    As you noticed, changing values affect the whole thread and hides the original issue from issues list and site-search

    I opened a new issue and reverted this one
    #484244: Show image when enter is pressed.

    #25

    hotcom - June 11, 2009 - 09:24

    Yes sorry about that but in my defense it's not real clear (I may be blind) how to open a request and it seems changing values (should not) affect the whole thread? Better it would open a new one automatically (Yes another feature request :)

    http://drupal.org/search/apachesolr_search/feature%20request

    Keep up the great work!

    #26

    Optalgin - June 11, 2009 - 16:39

    I agree this is confusing,
    I did the same mistake once for other issue :-)

    #27

    System Message - June 25, 2009 - 16:40
    Status:fixed» closed

    Automatically closed -- issue fixed for 2 weeks with no activity.

    #28

    Optalgin - October 25, 2009 - 22:40
    Title:Fatal error: Call to undefined function t() in /.../sites/all/modules/hide_submit/hide_submit.module on line 24» When site when cache is enabled I get - Fatal error: Call to undefined function t()
    Status:closed» active

    I'm re-opening this one following @mkrakowiak's post

    For a minute I thought this was now fixed, but then I got the following error:

    Fatal error: Call to undefined function t() in /home/sleekmod/public_html/cpj/sites/all/modules/hide_submit/hide_submit.module on line 280

    There are few solutions for this and I need to decide which one to use

    1. Remove the t() call and use a simple string , I don't like this solution
    2. Include common.inc - I have problem with this solution since I can't figure the base_path
    3. Move the code from hook_init to hook_menu - this is a wierd solution :-)

    Hope to close this soon...

    #29

    Optalgin - October 25, 2009 - 22:43
    Title:When site when cache is enabled I get - Fatal error: Call to undefined function t() » When site caching is enabled I get - Fatal error: Call to undefined function t()

    Updating the title :-)

     
     

    Drupal is a registered trademark of Dries Buytaert.