I took over a site using Twig 1.24.1 from 2016.
It also has some version of Timber baked into an old Sage theme. There is no Timber plugin.
If I update to PHP 8, I get a fatal error.
If I install the Timber plugin, I get a fatal error.
Is there some way to update Timber and Twig to work with PHP 8? I have found zero helpful info or docs about doing this here, at Github, at Upstatement, or in Google.
I also tried downloading Twig and swapping out some files and directories. That also failed hard. So I know how to break this site... but I'd really like to get it updated and stable.
Here's the error if it helps - which goes away in PHP 7.4.x
PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, Timber\Menu given in /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Template.php:533\nStack trace:\n#0 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Environment.php(403) : eval()'d code(23): Twig_Template->getAttribute(Object(Timber\Menu), 'get_items', Array)\n#1 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Template.php(387): __TwigTemplate_eada0446f028acb9eb859e593a68397ec9225f348f46a00ab74866dfa38d8f16->doDisplay(Array, Array)\n#2 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Template.php(355): Twig_Template->displayWithErrorHandling(Array, Array)\n#3 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Template.php(366): Twig_Template->display(Array)\n#4 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Environment.php(347): Twig_Template->render(Array)\n#5 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/timber/timber/lib/Loader.php(72): Twig_Environment->render('header.twig', Array)\n#6 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/timber/timber/lib/Timber.php(281): Timber\Loader->render('header.twig', Array, false, 'default')\n#7 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/timber/timber/lib/Timber.php(317): Timber\Timber::compile('header.twig', Array, false, 'default', true)\n#8 /nas/content/live/site/wp-content/themes/wobs-theme/vendor/timber/timber/lib/Timber.php(332): Timber\Timber::fetch('header.twig', Array, false, 'default')\n#9 /nas/content/live/site/wp-content/themes/wobs-theme/templates/header.php(37): Timber\Timber::render('header.twig', Array)\n#10 /nas/content/live/site/wp-includes/template.php(785): require('/nas/content/li...')\n#11 /nas/content/live/site/wp-includes/template.php(718): load_template('/nas/content/li...', false, Array)\n#12 /nas/content/live/site/wp-includes/general-template.php(204): locate_template(Array, true, false, Array)\n#13 /nas/content/live/site/wp-content/themes/wobs-theme/base-front-page.php(19): get_template_part('templates/heade...')\n#14 /nas/content/live/site/wp-includes/template-loader.php(106): include('/nas/content/li...')\n#15 /nas/content/live/site/wp-blog-header.php(19): require_once('/nas/content/li...')\n#16 /nas/content/live/site/index.php(17): require('/nas/content/li...')\n#17 {main}\n thrown in /nas/content/live/site/wp-content/themes/wobs-theme/vendor/twig/twig/lib/Twig/Template.php on line 533
Related
My website was built with wordpress and now I get the following error:
PHP message: PHP Warning: ob_start(): function '‘ob_gzhandler’' not
found or invalid function name in /var/www/html/wordpress/index.php on
line 15
And this is index.php:
enter image description here
Any idea to fix it?
Try setting the Content-Encoding header.
header('Content-Encoding: gzip');
I'm using SilverStripe 3.7.1 and PHP 7.2. To translate string in my template I use syntax
<%t Namespace.Entity "String_to_translate" %>
When length of the "String_to_translate" is more than 2045 symbols I get error:
[26-Jul-2018 10:18:33] Error at framework/view/SSTemplateParser.php line 4028: Uncaught SSTemplateParseException: Parse error in template on line 163. Error was: Malformed opening block tag t. Perhaps you have tried to use operators?
Can I change the maximum length of the string to translate?
I am using jshint which gives me the error "Unnecessary semicolon".
I do not control the file in question and I would like to ignore this error.
I am not able to find any such option on the jshint doc page
Turns out you can ignore any error message by setting an option for specific error numbers:
"-W032": true
I have created a website with drupal 6.34.
When i surfing to my drupal 6.34 site, i get the following error on the top of my page.I have searched drupal but couldn't figure it out where is the setting for it. I'm wondering if i should change the code as it mentions in the error frame?
what is it and how can i turn it of in drupal 6.34.
strict warning: Non-static method view::load() should not be called statically in /home/b15040be/public_html/sites/all/modules/views/views.module on line 903.
strict warning: Declaration of views_handler_field::query() should be compatible with views_handler::query($group_by = false) in /home/b15040be/public_html/sites/all/modules/views/handlers/views_handler_field.inc on line 726.
strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/b15040be/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 517.
strict warning: Declaration of views_handler_filter::query() should be compatible with views_handler::query($group_by = false) in /home/b15040be/public_html/sites/all/modules/views/handlers/views_handler_filter.inc on line 517.
strict warning: Declaration of views_plugin_query::init() should be compatible with views_plugin::init(&$view, &$display) in /home/b15040be/public_html/sites/all/modules/views/plugins/views_plugin_query.inc on line 139.
strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/b15040be/public_html/sites/all/modules/views/plugins/views_plugin_row.inc on line 137.
Strict warnings can be always turned of in your php.ini/.htaccess/settings.php so it is not a problem
http://drupal.org/node/465332#comment-1600034 explains some reasons why we can't fix it.
I'm trying to use http://ci-merchant.org/ for CodeIgniter. But when I load the merchant library, I get these errors:
A PHP Error was encountered
Severity: Warning
Message: stripos() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 97
A PHP Error was encountered
Severity: Warning
Message: strtolower() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 103
Here is my code:
$this->load->library('merchant');
$this->merchant->load('paypal_express');
Looking at the source of that file, the driver name needs to be passed as a string. So I highly doubt the two lines of code you put above is actually what's being called, it looks like you are passing an array as the driver name.
If you aren't sure where it's coming from, try adding some debug_print_backtrace() lines to the merchant.php file to figure out where the array is getting passed from.