Fli
10-22-2019, 08:43 PM
After moved Wordpress site to a new server with different PHP version 7.2 i seen an errors (which i was able to fix):
/* dynamic generated css*/
Fatal error: Uncaught Error: [] operator not supported for strings in ... /data/www/23595/domain/dir/wp-content/themes/florida-wp/inc/dynamicfiles/dyncss.php on line 40
dyncss.php and line 40 highlighted
$w_custom_font1_src = $w_custom_font2_src = $w_custom_font3_src ='';
//custom-font-1 font-face
if(isset($thm_options['webnus_custom_font1_eot']) && $thm_options['webnus_custom_font1_eot']!='')
$w_custom_font1_src[] = "url('{$thm_options['webnus_custom_font1_eot']}?#iefix') format('embedded-opentype')";
if(isset($thm_options['webnus_custom_font1_woff']) && $thm_options['webnus_custom_font1_woff']!='')
$w_custom_font1_src[] = "url('{$thm_options['webnus_custom_font1_woff']}') format('woff')";
if(isset($thm_options['webnus_custom_font1_ttf']) && $thm_options['webnus_custom_font1_ttf']!='')
$w_custom_font1_src[] = "url('{$thm_options['webnus_custom_font1_ttf']}') format('truetype')";
I read that in PHP 7.x i have to first define that variable as array like this:
$w_custom_font1_src = [];
so i was searching first occurence of $w_custom_font1_src in that file, it was this line:
$w_custom_font1_src = $w_custom_font2_src = $w_custom_font3_src ='';
below that line i added:
$w_custom_font1_src = [];
but that was not enough it then complained about other variables:
$w_custom_font2_src = [];
$w_custom_font3_src = [];
so at the end, i turned above mentioned line:
$w_custom_font1_src = [];
into:
$w_custom_font1_src = [];
$w_custom_font2_src = [];
$w_custom_font3_src = [];
Then i seen different error:
Fatal error: Uncaught Error: [] operator not supported for strings in ... /data/www/23595/domain/dir/wp-content/plugins/LayerSlider/includes/slider_markup_init.php on line 81
slider_markup_init.php file line 81 was like below highlighted in bold:
$data[] = '<script type="text/javascript">';
$data[] = 'var lsjQuery = jQuery;';
$data[] = '</script>';
so like before i first defined that variable $data as an array turning above mentioned lines into:
$data = [];
$data[] = '<script type="text/javascript">';
$data[] = 'var lsjQuery = jQuery;';
$data[] = '</script>';
(prepending 1 line to it)
that fixed it, but the /wp-admin/ page shown yet another "Uncaught Error: [] operator not supported for strings" in wp-content/plugins/revslider/inc_php/framework/base_admin.class.php on line 73
at line 73 was:
self::$arrMetaBoxes[] = $box;
i replaced this line by:
self::$arrMetaBoxes = [];
self::$arrMetaBoxes[] = $box;
no more errors ;)
/* dynamic generated css*/
Fatal error: Uncaught Error: [] operator not supported for strings in ... /data/www/23595/domain/dir/wp-content/themes/florida-wp/inc/dynamicfiles/dyncss.php on line 40
dyncss.php and line 40 highlighted
$w_custom_font1_src = $w_custom_font2_src = $w_custom_font3_src ='';
//custom-font-1 font-face
if(isset($thm_options['webnus_custom_font1_eot']) && $thm_options['webnus_custom_font1_eot']!='')
$w_custom_font1_src[] = "url('{$thm_options['webnus_custom_font1_eot']}?#iefix') format('embedded-opentype')";
if(isset($thm_options['webnus_custom_font1_woff']) && $thm_options['webnus_custom_font1_woff']!='')
$w_custom_font1_src[] = "url('{$thm_options['webnus_custom_font1_woff']}') format('woff')";
if(isset($thm_options['webnus_custom_font1_ttf']) && $thm_options['webnus_custom_font1_ttf']!='')
$w_custom_font1_src[] = "url('{$thm_options['webnus_custom_font1_ttf']}') format('truetype')";
I read that in PHP 7.x i have to first define that variable as array like this:
$w_custom_font1_src = [];
so i was searching first occurence of $w_custom_font1_src in that file, it was this line:
$w_custom_font1_src = $w_custom_font2_src = $w_custom_font3_src ='';
below that line i added:
$w_custom_font1_src = [];
but that was not enough it then complained about other variables:
$w_custom_font2_src = [];
$w_custom_font3_src = [];
so at the end, i turned above mentioned line:
$w_custom_font1_src = [];
into:
$w_custom_font1_src = [];
$w_custom_font2_src = [];
$w_custom_font3_src = [];
Then i seen different error:
Fatal error: Uncaught Error: [] operator not supported for strings in ... /data/www/23595/domain/dir/wp-content/plugins/LayerSlider/includes/slider_markup_init.php on line 81
slider_markup_init.php file line 81 was like below highlighted in bold:
$data[] = '<script type="text/javascript">';
$data[] = 'var lsjQuery = jQuery;';
$data[] = '</script>';
so like before i first defined that variable $data as an array turning above mentioned lines into:
$data = [];
$data[] = '<script type="text/javascript">';
$data[] = 'var lsjQuery = jQuery;';
$data[] = '</script>';
(prepending 1 line to it)
that fixed it, but the /wp-admin/ page shown yet another "Uncaught Error: [] operator not supported for strings" in wp-content/plugins/revslider/inc_php/framework/base_admin.class.php on line 73
at line 73 was:
self::$arrMetaBoxes[] = $box;
i replaced this line by:
self::$arrMetaBoxes = [];
self::$arrMetaBoxes[] = $box;
no more errors ;)