Support » Fixing WordPress » Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM

  • Resolved legendary-tech

    (@legendary-tech)


    Hi there,

    I have a problem I am not being able to resolve for three days now. Here is what happened. On Monday I had perfectly functioning website running on WP with activated custom theme, but then unfortunately, I activated one of the child WooCommerce plugins, and after that the website went blank. It did not respond at all. Then I made a mistake, instead of deleting that plugin in FTP – I removed completely the WP installation along with the theme and plugins. Then I reinstalled the WP engine on that domain, and uploaded the theme, but when I try to activate it – the website goes blank (white screen of death). Even if I try to Live Preview that theme, the preview screen goes blank (white screen again!).
    So, I looked around the Support Forum, and here are some of my details.
    I checked theme folder permissions (they are 755), server is running on 5.329 PHP version. I turned on WP DEBUG and when I try to preview the uploaded customs theme it displays:

    Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/legtech/KERWEN/kerwen.tk/wp-content/themes/customengine/includes/core/lib/schema/Schema.php on line 19

    That line 19, when opened in Code Editor says:

    16`private static function fillter($schema = null, $prop = null, $val = null)
    17 {
    18 if ($prop != null) {
    19 return $schema::getInstance()->prop($prop, $val);
    20 } else {
    21 return $schema::getInstance()->scope();
    22 }
    23 }`

    I have no idea what is wrong. The theme was working perfectly on Monday and weeks before that, but after that WooCommerce pluging everything went down and now the theme cannot be activated.

    Could anyone please help me with this, I would be very grateful for any help or advice.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The issues appears to be related to your theme files. I would suggest contacting the themes author for better support.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    return $schema::getInstance()->prop($prop, $val);

    That appears to be an actual syntax error in the theme to me.

    For reference, T_PAAMAYIM_NEKUDOTAYIM is the token name in PHP for the double colon mark. (It’s Hebrew for “double colon”).

    A call like this is how you call a static function in a class. Like this code would be correct:

    class ClassName {
      public static function getInstance() {
        // does stuff
      }
    }
    
    $value = ClassName::getInstance();

    But calling a static function on a variable doesn’t make any real sense. A variable is an instance of the class, you would not call static functions for an instance of the class.

    So, yeah, ask the theme author what is up, because their code is wrong.

    Thread Starter legendary-tech

    (@legendary-tech)

    Follow-up on the problem,

    I contacted the theme developer, they suggested to replace the:

    private static function fillter($schema = null, $prop = null, $val = null)
    {
    if ($prop != null) {
    return $schema::getInstance()->prop($prop, $val);
    } else {
    return $schema::getInstance()->scope();
    }
    }

    to the following code:

    private static function fillter($schema = null, $prop = null, $val = null)
    {
    $object = new $schema();
    if ($prop != null) {
    return $object->prop($prop, $val);
    } else {
    return $object->->scope();
    }
    }

    However, that ended up in another message showing up:

    Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting T_STRING or T_VARIABLE or ‘{‘ or ‘$’ in /home/legtech/KERWEN/kerwen.tk/wp-content/themes/customengine/includes/core/lib/schema/Schema.php on line 22

    Developers told me that I should contact my hosting provider and upgrade PHP version on the servers up to 5.4.

    I contacted the hosting provider, explained them the situation, and now awaiting the results. I will keep posting updates.
    Meanwhile, what might be causing this error? It is bad coding of the theme? Or is it related to PHP version on the servers?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    It is bad coding of the theme?

    Yeah. That.

    Use a different theme.

    Thread Starter legendary-tech

    (@legendary-tech)

    Upgraded the PHP on servers to 5.4, but it did not resolve the activation problem, so I went with another theme.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    For reference, this is the error in the code there:

    return $object->->scope();

    Not sure if that was a copy paste error or just typo’d bad code from the author, but that’s not valid PHP. It would be valid if there was only one -> operator there.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM’ is closed to new replies.