• Resolved Alexey

    (@dvascheta)


    After upgrade to v4.8 found my site unavailable. Turned on logging and got:

    Parse error: syntax error, unexpected ‘[‘ in /home/…/wp-content/plugins/xml-sitemap-feed/includes/class-xmlsitemapfeed.php on line 275

    There I found (275 is bold):

    // news sitemap tags settings
    $this->defaults[‘news_tags’] = array(
    ‘name’ => ”,
    ‘post_type’ => [‘post’],
    ‘categories’ => ”,
    ‘image’ => ‘featured’,
    ‘access’ => array(
    ‘default’ => ”,

    I looked to ver 4.7 and there was ‘post_type’ => array(‘post’),

    So I returned previous syntax and my site is alive again.

    I do not know PHP so have no idea if this change was necessary or just mistake, and if necessary, how can I make my site work with [‘post’].

Viewing 7 replies - 1 through 7 (of 7 total)
  • I tried your fix and it worked to get site visible again but have new error at

    Parse error: syntax error, unexpected ‘[‘ in D:\Hosting\2772443\html\wp-content\plugins\xml-sitemap-feed\includes\class-xmlsitemapfeed-admin.php on line 632

    and I cannot access my dashboard now.

    Any ideas?

    Thread Starter Alexey

    (@dvascheta)

    Yes, really. I didn’t need to visit dashboard today and didn’t notice.

    Edit class-xmlsitemapfeed-admin.php, change pairs of square brackets to array()

    near line 632 now:
    // genres tag
    $gn_genres = parent::gn_genres();
    $genres = !empty($options[‘genres’]) ? $options[‘genres’] : [];
    $genres_default = !empty($genres[‘default’]) ? (array)$genres[‘default’] : [];

    to be:
    // genres tag
    $gn_genres = parent::gn_genres();
    $genres = !empty($options[‘genres’]) ? $options[‘genres’] : array();
    $genres_default = !empty($genres[‘default’]) ? (array)$genres[‘default’] : array();

    same changes near line 655 (to be):

    // keywords
    $keywords = !empty($options[‘keywords’]) ? $options[‘keywords’] : array();

    Should help

    Thread Starter Alexey

    (@dvascheta)

    I see your sitemap working well now. How do I fix errors:

    1) edit wp-config.php: change values to “true” and “on” in lines (or add them)

    define(‘WP_DEBUG’, false);
    define(‘WP_DEBUG_LOG’, false);
    define(‘WP_DEBUG_DISPLAY’, false);
    @ini_set(‘display_errors’,’off’);

    2) reload page and get error like

    Parse error: syntax error, unexpected ‘[‘ in /home/…/wp-content/plugins/xml-sitemap-feed/includes/class-xmlsitemapfeed.php on line 275

    3) download previous version of plugin (just get current version download link and change “4.8” with “4.7”)

    4) find difference between mentioned lines in mentioned file in ver 4.8 and 4.7

    5) edit file on my hosting so as it was in ver 4.7

    6) bug is fixed or found in other place (if so, repeat 4)-5) )

    7) edit wp-config.php: change values to “false” and “off” (important for site security!)

    • This reply was modified 6 years, 8 months ago by Alexey.
    Thread Starter Alexey

    (@dvascheta)

    And we are all still looking forward to ver 4.9 working everywhere without tricks…

    • This reply was modified 6 years, 8 months ago by Alexey.

    These tricks should not be needed if you upgrade your PHP version to at least 5.4.1 but even that version is not supported anymore. Version 5.6 is the lowest version that still receives security updates but even that will stop by the end of the year.

    Your site is at risk with an old PHP version that is no longer maintained. WordPress recommends version 7.0 or higher.

    Using [] instead of array() is equivalent but is only supported in php >= 5.4

    Thread Starter Alexey

    (@dvascheta)

    Thanks, I didn’t think about it. Really had 5.3, changed to 7.1

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Ver 4.8 breaks site’ is closed to new replies.