I just upgraded to 7.x-3.3 yesterday.
The error is:
[Fri Dec 18 02:53:23 2015] [error] [client 66.249.79.182] PHP Fatal error: Call to undefined function bootstrap_setting() in /srv/uat/ecolsoc.org.au/web/sites/all/themes/bootstrap/templates/system/page.vars.php on line 28
To reproduce.
The Bootstrap theme is a secondary one.
- Configure 'themekey' to set a specific page to bootstrap
- View the page in bootstrap.
- View page in 'default theme'. The error appears.
- reset cache - it goes away. But comes back each time you look at bootstrap theme.
I could patch it - add if function_exists before everything. There are about 120 places and it would mess up the code. Could load the file somewhere else in drupal that is not conditional too I guess.
Comments
Comment #2
interlated CreditAttribution: interlated as a volunteer commentedIs there a way to include classes from a theme info file like you do with modules? I can't see it but could setup a class.
Comment #3
markhalliwellThis isn't an issue with this project. The
bootstrap_setting()
function is located in./includes/common.inc
which is immediately the first file included in the theme'stemplate.php
file. If you're getting this error, then it's a problem with whatever is "initializing" the theme as it should be including a theme'stemplate.php
file (including any theme ancestry, aka base themes). Core initializes the active theme (and it's ancestry) before attempting to run any preprocess functions.Comment #4
interlated CreditAttribution: interlated as a volunteer commentedSo copy the contents of the existing template.php and put it into the bootstrap subtheme template? I didn't have any such stuff in there before.
My problem is that a theme not related to bootstrap - 5 year old one - is failing after bootstrap upgrade.
As a hack I was thinking of putting these includes into the old (seven) theme.
Comment #5
markhalliwellSo your getting this error on a non-bootstrap based theme? That makes no sense. The
page.vars.php
is only ever added as an include file for thepage
theme hook if the theme is bootstrap based. So I can only imagine the above error occurring if one of the following is happening:bootstrap_hook_theme_complete()
).base theme = bootstrap
in it's .info file (unlikely, because then the base-theme would load and the error wouldn't occur).bootstrap/templates/system/page.vars.php
(this is the likely scenario, although I wouldn't even begin to know why... core doesn't alter theme registries of base themes for sub-themes that don't specify that base theme).In any case, what I'm saying is: your specific issue is very odd, shouldn't be happening and the error message is just a symptom of an entirely separate issue (not this project).
Comment #6
interlated CreditAttribution: interlated as a volunteer commentedYes - I thought it must be a cached page or page component. Clearing the cache seems to fix it for a while.
Viewing the 'default site seven based theme' fails. The seven based theme has been around for a long time so it is possible there is a module that is 'doing something stupid'. I only added bootstrap 3 months ago or so. The bootstrap based theme never fails to display. I'm blaming an interaction with themekey. It did all seem to be working OK until I updated the bootstrap base theme though.
There are actually a bunch of these types of error message. Triggered from the homepage (http://uat.ecolsoc.org.au):
500 error from seven based theme (homepage)
144.132.191.141 - - [18/Dec/2015:19:39:24 +0000] "GET / HTTP/1.1" 500 1 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
Has this function this time:
[Fri Dec 18 19:39:25 2015] [error] [client 144.132.191.141] PHP Fatal error: Call to undefined function _bootstrap_get_attributes() in /srv/uat/ecolsoc.org.au/web/sites/all/themes/bootstrap/templates/system/form-element-label.func.php on line 57
I have 131 'bootstrap_setting' error and 36 bootstrap_get_attributes in the error log to give an idea of the proportions.
Will keep looking/debugging.
Comment #7
markhalliwellHm. Is it possible you may have two versions of the bootstrap base theme installed (i.e. and older version is located somewhere else)? Have you tried completely removing the bootstrap base theme and re-installing? Maybe some files didn't get replaced/copied right?
Comment #8
interlated CreditAttribution: interlated as a volunteer commentedBelow is a call stack. I'll see if I can debug it.
I tried updating bootstrap. A couple of things changed. Mainly bootstrap.info. 1 line in bootstrap.admin.js a description tag in theme-settings.php. I'll have a look and see if it is all due to subsequent changes.
# Time Memory Function Location
1 0.0007 239600 {main}( ) .../index.php:0
2 0.7180 21190448 menu_execute_active_handler( ) .../index.php:21
3 0.7181 21192280 call_user_func_array:{/Users/johnrobens/Sites/ecolsoc/web/includes/menu.inc:527} ( ) .../menu.inc:527
4 0.7181 21192616 page_manager_page_execute( ) .../menu.inc:527
5 0.7540 26724440 ctools_context_handler_render( ) .../page.inc:322
6 0.7854 26924960 ctools_context_handler_render_handler( ) .../context-task-handler.inc:44
7 0.7855 26925992 panels_panel_context_render( ) .../context-task-handler.inc:121
8 0.7909 26992240 panels_render_display( ) .../panel_context.inc:338
9 0.7909 26992464 panels_display->render( ) .../panels.module:1130
10 0.7915 26992976 panels_renderer_standard->render( ) .../panels.module:764
11 0.7916 26995896 panels_renderer_standard->render_layout( ) .../panels_renderer_standard.class.php:360
12 0.8048 27414408 panels_renderer_standard->render_panes( ) .../panels_renderer_standard.class.php:389
13 0.8376 29550488 panels_renderer_standard->render_pane( ) .../panels_renderer_standard.class.php:482
14 0.8376 29550488 panels_renderer_standard->render_pane_content( ) .../panels_renderer_standard.class.php:503
15 0.8376 29550672 ctools_content_render( ) .../panels_renderer_standard.class.php:567
16 0.8394 29551528 ctools_block_content_type_render( ) .../content.inc:281
17 0.8467 29953416 module_invoke( ) .../block.inc:148
18 0.8467 29953944 call_user_func_array:{/Users/johnrobens/Sites/ecolsoc/web/includes/module.inc:905} ( ) .../module.inc:905
19 0.8467 29954280 webform_block_view( ) .../module.inc:905
20 1.1126 40006064 drupal_render( ) .../webform.module:2304
21 1.1127 40007472 theme( ) .../common.inc:6002
22 1.1127 40008112 theme_webform_view( ) .../theme.inc:1161
23 1.1127 40012840 drupal_render( ) .../webform.module:2061
24 1.1128 40018424 theme( ) .../common.inc:6002
25 1.1129 40022840 theme_render_template( ) .../theme.inc:1208
26 1.1130 40050336 include( '/Users/johnrobens/Sites/ecolsoc/web/sites/all/modules/contrib/webform/templates/webform-form.tpl.php' ) .../theme.inc:1525
27 1.1130 40051840 drupal_render( ) .../webform-form.tpl.php:37
28 1.1132 40059432 drupal_render( ) .../common.inc:6009
29 1.1133 40064272 theme( ) .../common.inc:6017
30 1.1134 40071256 theme_webform_element( ) .../theme.inc:1161
31 1.1135 40072192 theme( ) .../webform.module:3652
32 1.1135 40073952 bootstrap_form_element_label( ) .../theme.inc:1161
Comment #9
interlated CreditAttribution: interlated as a volunteer commentedThis could be a duplicate of https://www.drupal.org/node/2051135 (Mail System breaks theme registry) which is also duplicated in bootstrap theme https://www.drupal.org/node/2615978 (Undefined variables in system template files)
I applied the mailsystem patch and it seems to have fixed the problem.
Comment #10
xaris.tsimpouris CreditAttribution: xaris.tsimpouris as a volunteer commentedI can also confirm that is related to #2051135. After updating mailsystem to its latest dev version (7.x-2.x /2016-Feb-13) problem has been solved. For me the problem was showing as a WSOD while using the default theme and the following error stopped to show each time after a clear all caches.
Call to undefined function bootstrap_setting() in sites/all/themes/bootstrap_admin/templates/page.vars.php on line 28
I have custom bootstrap sub-theme set as Admin theme.
Comment #11
wesleymusgrove CreditAttribution: wesleymusgrove commentedTLDR;
Confirming that @xaris.tsimpouris is correct and this is related to #2051135: Mail System breaks theme registry.
Full version:
When I updated the version of the bootstrap theme (/sites/all/themes/bootstrap) from 7.x-3.0 to 7.x-3.6, several fatal PHP errors were occurring related to changes in bootstrap. It's almost behaving as if the Seven admin theme was still trying to use cached functions belonging to the old version of bootstrap or not able to recognize new functions provided by the new version of bootstrap.
In Dev and Staging environments, I was able to fix these issues by running `drush vset admin_theme garland` to set the admin theme to Garland instead of Seven. Then I cleared all of the Drupal cache on any admin page. Then I went to https://www.example.com/admin/appearance and switched the admin theme back to Seven. This resolved the fatal PHP errors in Dev and Staging.
When I follow these same steps in Prod and switch back to the Seven theme (from Garland) after clearing the cache, I still receive fatal PHP errors on every admin page using the Seven theme.
Upgrading the Mailsystem module from 7.x-2.34 to 7.x-2.34+5-dev resolved the issue for me. I was able to switch the admin theme back to Seven and clear the cache without any fatal PHP errors.
Comment #12
pagach CreditAttribution: pagach commentedI get Undefined function bootstrap_setting() error in the log when trying to use DRUPAL_BOOTSTRAP_FULL in an independent php script.
None of the solutions above worked so i switched to DRUPAL_BOOTSTRAP_DATABASE
Any ideas how to get it working with DRUPAL_BOOTSTRAP_FULL?
Comment #13
vvc CreditAttribution: vvc as a volunteer commentedHi pagach,
I don't know if you're still having this issue but I had a similar issue recently (I use DRUPAL_BOOTSTRAP_FULL to assist with some web service functions).
I noted that the error was being generated in a module within the installed bootstrap theme - in particular the images.vars.php - so I took a safety copy of that file and then modified the bootstrap_preprocess_image function to first check if the bootstrap_setting function exists before calling it (there were two places that needed to be checked).
This solved my issue - for now!