• Resolved rraszews

    (@rraszews)


    I’ve been getting an error since the last update, but it doesn’t seem to be the one everyone else was getting. I assume my provider is doing something wonky, but I was hoping I could get some more info here that I could take to them. The error I get is:

    PHP Parse error: syntax error, unexpected ‘[‘ in /snipped-for-brevity/wp/wp-content/plugins/ip-geo-block/classes/class-ip-geo-block-util.php on line 132

    It seems to be complaining about the line ‘$args = [];’

    The problem persisted after I did an uninstall and reinstall.

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author tokkonopapa

    (@tokkonopapa)

    Hi @rraszews,

    I’ve been getting an error since the last update,

    Yes, the code you reported was added from the updated version and of course I tested that part of code. So unfortunately, I can not find any reason of cause of the issue.

    You know the code $args = []; itself does not have any issue. So we have to investigate digging into deeper.

    So my suggestions are:

    1. Deactivate all the plugins you have except IPGB and activate one by one. If some compatibility issue were there, we can find the sign of this issue.

    2. If you can not do 1. then please try to observe the debug information at the PHP level. Please refer to the following documents:

    According to the documents, you can put the following code in “wp-config.php” instead of the original line define('WP_DEBUG', false); at “For developers: WordPress debugging mode.” block.

    /**
     * For developers: WordPress debugging mode.
     *
    ...(omitted)
    
     * @link https://codex.ww.wp.xz.cn/Debugging_in_WordPress
     */
    define('WP_DEBUG', true);
    
    // https://codex.ww.wp.xz.cn/Debugging_in_WordPress
    if ( WP_DEBUG ) {
        define( 'WP_DEBUG_LOG', true );      // save to wp-content/debug.log
        define( 'WP_DEBUG_DISPLAY', false ); // do not display on browser
        @ini_set( 'display_errors', 0 );     // do not display on browser
    }

    Then you can find Warnings/Errors in the file /wp-content/debug.log.

    I’d appreciate your cooperation.
    Thanks.

    • This reply was modified 8 years, 2 months ago by tokkonopapa.
    Thread Starter rraszews

    (@rraszews)

    Thanks for looking at this. I turned on debugging and only got a little more information:

    [03-Apr-2018 01:43:24 UTC] PHP Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /hermes/bosnaweb22a/b844/glo.rraszews/wp/wp-includes/functions.php on line 4147
    [03-Apr-2018 01:43:25 UTC] PHP Notice: has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead. in /hermes/bosnaweb22a/b844/glo.rraszews/wp/wp-includes/functions.php on line 4031
    [03-Apr-2018 01:43:25 UTC] PHP Parse error: syntax error, unexpected ‘[‘ in /hermes/bosnaweb22a/b844/glo.rraszews/wp/wp-content/plugins/ip-geo-block/classes/class-ip-geo-block-util.php on line 132

    These lines repeat several times. Unfortunately, those line numbers are just showing where the error message was generated, not where the offending function call was.

    I’ll try disabling other plugins, but it’ll be a few days before I have time to go through that.

    Kristian

    (@kristiandeimel)

    Got the same error with PHP 5.3.10, but not on another site with PHP 7.0.28. Problem with old PHP version?

    Anyway, thanks for the good plugin!

    Thread Starter rraszews

    (@rraszews)

    Oh, I bet that’s it. I found this in a PHP reference guide:

    As of PHP 5.4, it is possible to use a short array syntax, which replaces array() with [].

    I’ll have to see if I can talk my hosting provider into updating their php installation.

    Plugin Author tokkonopapa

    (@tokkonopapa)

    Oh, it’s also my mistake because other part of the code, I use array().

    I uploaded the code for PHP less than 5.4 at gist.

    You can use it. But requirements of WordPress is now PHP 7.2 or grater.

    So I think you had better to ask your hosting provider to update the version of PHP as you said.

    Thanks for your reporting.

    Thread Starter rraszews

    (@rraszews)

    Thanks for all the help. I changed the default PHP version for my site (turned out that they support newer versions but default to the version-as-of-when-your-account-was-opened for compatibility reasons) and it’s working again now. (Well, ip geo block is. Turned out that I did have some other plugins which broke under php 7, but that’s my problem.)

    • This reply was modified 8 years, 2 months ago by rraszews.
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘(different) error after latest update.’ is closed to new replies.