A few d6 sites, not all, after update to 6.35 core are giving error when user links point to path /user/login?destination=frontpage

Fatal error: Call to undefined function t() in /.../.../includes/menu.inc on line 1538

Sometimes clearing the cache solves the problem only to have it return and sometimes clearing the cache does not help.

I'm really stumped.

Any suggestions on how to resolve the fatal error would be appreciated. Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

izmeez’s picture

Project: LoginToboggan » Secure Pages

So far I have tracked this down to be a problem with securepages and logintoboggan.

For some reason the site is not switching to https:// on paths with user* but was before.

izmeez’s picture

Issue summary: View changes

Issue summary updated.

izmeez’s picture

Title: Error on some sites after update to drupal 6.35 on path /user/login?destination=frontpage » Resolved: Error on some sites after update to drupal 6.35 on path /user/login?destination=frontpage
Status: Active » Closed (fixed)

Resolved with update to securepages-6.x-2.x

IFL Todd’s picture

Status: Closed (fixed) » Active

How is this resolved? securepages-6.x-2.x still produces the same error mentioned by the OP after upgrade to D6.35.

izmeez’s picture

With securepages-6.x-2.x-dev it is working for us. Don't know about securepages-6x-2.1

[edit] checked another site using 6.x-2.1 and seems to be fine there too. [/edit]

IFL Todd’s picture

Priority: Normal » Major

Every instance I have of D6.35 with Secure Pages 6.x-2.1, even on different servers, produces the error.
Fatal error: Call to undefined function t() in includes/menu.inc on line 1538.

The error occurs also when clearing cache, not through Drush but through the CC link in admin_menu, and often when even trying to edit content. I have admin* as an https path btw, if that makes any difference.

This really should be a critical issue.

gcassie’s picture

I don't think this is a contrib issue, rather some of the security checks in the new core release are triggering some of the menu translation behavior before Drupal has finished bootstrapping enough to have access to all the required functions. I was able to get some different errors with this patch, which I don't think is the final solution, but a start:

diff --git a/docroot/includes/bootstrap.inc b/docroot/includes/bootstrap.inc
index 3b2cf1b..fbceb65 100644
--- a/docroot/includes/bootstrap.inc
+++ b/docroot/includes/bootstrap.inc
@@ -1186,6 +1186,7 @@ function _drupal_bootstrap($phase) {
       // because menu_path_is_external() requires the variable system to be
       // available.
       if (isset($_GET['destination']) || isset($_REQUEST['destination']) || isset($_REQUEST['edit']['destination'])) {
+        require_once './includes/common.inc';
         require_once './includes/menu.inc';
         drupal_load('module', 'filter');
         // If the destination is an external URL, remove it.

The new errors after that change are

[14-Apr-2015 23:08:09 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'og_features_menu_access_callback' not found or invalid function name in /mnt/www/html/xxx/docroot/includes/menu.inc on line 454
[14-Apr-2015 23:08:09 UTC] PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'og_features_menu_access_callback' not found or invalid function name in /mnt/www/html/xxx/docroot/includes/menu.inc on line 454
[14-Apr-2015 23:08:09 UTC] PHP Fatal error:  Call to undefined function user_uid_optional_to_arg() in /mnt/www/html/xxx/docroot/includes/menu.inc on line 608

So, more menu shenanigans. I can't reliably reproduce the originally reported error, but with that patch I get the new errors when I log out - the page seems to render okay despite them. Your mileage will vary by what contrib you have installed, I expect.

Spent some time tracing through but haven't pinpointed when these things are trying to execute.

underq’s picture

FileSize
518 bytes

Hi,

I suggest the patch, for fix this Drupal core bug included in 6.35 version.

The bug caused by menu.inc which is include too soon.

case DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE:
      // Initialize configuration variables, using values from settings.php if available.
      $conf = variable_init(isset($conf) ? $conf : array());

      // Sanitize the destination parameter (which is often used for redirects)
      // to prevent open redirect attacks leading to other domains. Sanitize
      // both $_GET['destination'] and $_REQUEST['destination'] to protect code
      // that relies on either, but do not sanitize $_POST to avoid interfering
      // with unrelated form submissions. $_REQUEST['edit']['destination'] is
      // also sanitized since drupal_goto() will sometimes rely on it, and
      // other code might therefore use it too. The sanitization happens here
      // because menu_path_is_external() requires the variable system to be
      // available.
      if (isset($_GET['destination']) || isset($_REQUEST['destination']) || isset($_REQUEST['edit']['destination'])) {
        require_once './includes/menu.inc';
        drupal_load('module', 'filter');
izmeez’s picture

Feel free to change the title and metadata to better reflect the current thoughts on this issue.

My problem was as initially described and appears resolved but clearly others are experiencing issues.

IFL Todd’s picture

Title: Resolved: Error on some sites after update to drupal 6.35 on path /user/login?destination=frontpage » Errors on some sites after update to drupal 6.35 paths secured by Secure Pages.
Version: 6.x-1.x-dev » 6.x-2.1
Component: Miscellaneous » Code
Category: Support request » Bug report
Priority: Major » Critical

It seems that some paths secured by Secure Pages get the error after upgrade to Drupal 6.35; although, I'm not sure to what extent. In my case (again across several sites and servers) admin sections and certain views related edit links are producing the error when clicked. The error is a WSOD error and is causing problems for site administrators, who are having to troubleshoot, or jump through hoops to get to the content they wish to access and edit.

underq, is this a Drupal core issue? I ask, because it obviously comes after a core update; however, is the core bugged or is it just how core is changed and other modules need to update likewise to reflect the change?

Fatal error: Call to undefined function t() in includes/menu.inc on line 1538.

The error doesn't seem to happen for paths not secured by SP.

izmeez’s picture

For the WSOD since this is drupal 6 have you tried the dtools wsod module to see if that helps point to the problem?

IFL Todd’s picture

Upon further testing, the error does not occur if certain paths are excluded from Secure Pages, such as user* and admin*. Those are obviously the kind of paths which need to be secured.

Fatal error: Call to undefined function t() in includes/menu.inc on line 1538.

izmeez’s picture

We are including those paths (user* and admin*) without problems.

IFL Todd’s picture

Perhaps then it is a core problem as gcassie suggested. I've made a post in core about this as a result.

izmeez’s picture

On the d6 sites we are working with we are not having the issue beyond what was described above. If you can provide a way to reproduce the problem you are experiencing it may help.

IFL Todd’s picture

I might be to stupid to live. I just wanted to admit that. I did a fresh install that I was going to use to test and to answer izmeez' question and I could not reproduce the error. Everything worked just fine. Puzzled, I actually opened the files on the sites experiencing the problem and they were all 6.x-1.11 and I was mistaken! I always use drush to update modules, and never realized the sites were all still using 6.x-1.11. I am very sorry for making this mistake.

Closing and marking as fixed.

IFL Todd’s picture

Status: Active » Closed (fixed)
izmeez’s picture

Good to hear. We have all had those moments :-) Don't forget to close the core issue also.

IFL Todd’s picture

This core issue has also been closed. izmeez thanks for you understanding.

gcassie’s picture

Noting the site I was experiencing this error on does not run Secure Pages, so I'm re-opening the core issue.

bsenftner’s picture

I am seeing this issue on a site not running Secure Pages too. The site has three different instances of D6.35, (Development, Staging, and Live) all separate installs on separate servers, but the same site code and configuration. Only the Live version is experiencing the t() function undefined in menu.inc

bsenftner’s picture

I've applied the patch given by underq at https://www.drupal.org/node/2455675#comment-9832631 and will report back if this fixes my t() undefined in menu.inc issue for a site with no Secure Pages module.

27 hours later: the patch appears to be doing it's duty. whereas the site with the issue was hitting this issue 1-2 times per 24 hour period, it has not happened for 27 hours and counting. I will report back if it does occur, but so far so good.

underq’s picture

My first patch, remove too many title,
I propose new patch which is more accurate.

gregstout’s picture

My site was getting this 50% of the time for secured pages (/user and some /admin) especially when destination= was being used.
I tried the patch by underq above (https://www.drupal.org/node/2455675#comment-9951023) and it seems to work for our site. Thanks!

munyiva’s picture

Thank you, trying this now.

rooby’s picture

Status: Closed (fixed) » Closed (duplicate)

Why are people posting Drupal core patches to a secure pages issue?

The relevant issue for Drupal core is #2474625: Fatal Error: Call to undefined function t() in menu.inc on line 1538 and it's not fixed.

If you want this patch committed post it there. Also add a comment in the code to explain why it is checking destination like it is because it is not obvious by reading the code.

Changing the status of this one as it is a duplicate of that one and no fix was made here.

rooby’s picture