• File list-posts-alphabetically.php is incorrectly handling a variable, and it’s throwing a PHP Warning and creating very large error logs. Three errors on each pass:

    Illegal string offset 'category' in /home/AccountName/public_html/wp-content/plugins/list-posts-alphabetically/list-posts-alphabetically.php on line 19
    Cannot assign an empty string to a string offset in /home/AccountName/public_html/wp-content/plugins/list-posts-alphabetically/list-posts-alphabetically.php on line 19
    Illegal string offset 'category' in /home/AccountName/public_html/wp-content/plugins/list-posts-alphabetically/list-posts-alphabetically.php on line 24

    Here is the code causing the warning:

    function lpa_az_func( $lpa_az_atts ) {
    	var_dump($lpa_az_atts);
    	die("<BR><BR>X".$lpa_az_atts."Y");
        $lpa_az_a = shortcode_atts( array(
            'category' => '',
        ), $lpa_az_atts );
    
    if (!isset($lpa_az_atts['category'])) {
    	$lpa_az_atts['category'] = '';
    }
    
    $lpa_az_args = array(
      'numberposts' => 1000,
      'category_name'  => $lpa_az_atts['category'],
      'orderby' => 'title',
      'order' => 'ASC'
    );
     

    The problem is that $lpa_az_atts is being treated as an array, but it is merely a string variable.

    Any chance this will be fixed in an upcoming update?

  • The topic ‘PHP Warning’ is closed to new replies.