Home > database >  why I am getting this notice in my website
why I am getting this notice in my website

Time:06-29

I m getting this error notice on my website Notice: Trying to access array offset on value of type null in /home/wouogkqedr4z/public_html/wp-content/plugins/kingcomposer/includes/kc.front.php on line 566 try{

        /*
        *   Decode JSON object
        */      
        $screens = json_decode( str_replace( '`', '"', $code ), true );

        /*
        *   Sort screens
        */

line566- if (is_array( $screens['kc-css'])) {

            kc_screen_sort ($screens['kc-css']);

            foreach ($screens['kc-css'] as $screen => $groups)
            {
            
                $css_array = array(); 
                $css_code_itm = '';
                

CodePudding user response:

Before accessing an index, try checking that the $screens is indeed an array using the is_array() function.

if ( is_array( $screens ) && is_array(  $screens['kc-css'] )

CodePudding user response:

You get errors when you don't have values in the array. So when you use array try to check it first.

if (!empty($screens['kc-css']))
  •  Tags:  
  • php
  • Related