Support » Plugin: Responsive Menu » unexpected T_FUNCTION

  • Resolved Joseph G.

    (@illumination2025)


    Parse error: syntax error, unexpected T_FUNCTION in …/public_html/wp/wp-content/plugins/responsive-menu/responsive-menu.php on line 37

    php version: 5.4.24

    The only site doing it, as far as I can tell. I just migrated from my dev server to bluehost. I had to migrate manually and still the site did not come up… error in the plugin. I deleted and reinstalled, and this is the error I receive now.

    Any help would be greatly appreciated! 🙂

    Thanks!

    -joseph

Viewing 10 replies - 1 through 10 (of 10 total)
  • Joseph G.

    (@illumination2025)

    Interesting, tried all three versions of php 5.4 as well, and still the error. No clue at this point. 😀

    Joseph G.

    (@illumination2025)

    Despite what the cpanel states in the bluehost account, it’s NOT the right version of PHP, even after I changed the PHP Config area… so, will call Bluehost now, as it’s 5.2… Unreal… you would think they would get the right version showing in their cpanel.

    Status Closed!

    Hope all is well!

    There is only one “version” of PHP 5.4 on Bluehost servers. The difference is fcgi, single php.ini, or regular. There is obviously something strange going on here for a few reasons.

    1) If the Bluehost cpanel says you are on a version of PHP, the only way that can be changed is if you have custom handlers in your .htaccess or changing it in the cpanel interface. If there is a bug in our interface please report it and I will personally investigate it. Please check your .htaccess file and make sure that aren’t any custom PHP handlers overriding Bluehost’s configuration.

    2) This plugin supposedly checks the PHP version and deactivates itself if its using less than PHP 5.4. Either the plugin author doesn’t know what they’re doing or there’s just an accidental error in their code. I like to give the benefit of the doubt and assume its an accidental bug.

    Either way, please report your findings.

    Joseph G.

    (@illumination2025)

    Thanks for the response, and perhaps someone will find it of use.

    After being on hold for a little under thirty minutes, the tech guy straightened it out. Our connection was poor, so we didn’t discus, just trying our best to understand the bare minimum in discussion. He ‘fixed’ it, whatever was happening.

    In the cpanel, it showed one thing, but phpinfo() was showing something else. I would have asked more information, but again, the connection was sooooooooooooo bad, it was amazing we even got through what we did.

    For others, if you see one version in your cpanel at bluehost, perhaps still try to create a file like test.php with the following code in it, just to double check if it’s the ‘right’/matching version:

    
    <?php phpinfo(); ?>
    

    If they are different, perhaps it’s time to give bluehost a call.

    So, all good here!

    Appreciate your help and all that you have done in offering such a wonderful plugin.

    Hope all is well!

    Sincerely,

    -joseph

    • This reply was modified 3 years, 2 months ago by Joseph G..
    Plugin Author Responsive Menu

    (@responsivemenu)

    “This plugin supposedly checks the PHP version and deactivates itself if its using less than PHP 5.4. Either the plugin author doesn’t know what they’re doing or there’s just an accidental error in their code. I like to give the benefit of the doubt and assume its an accidental bug.”

    Excuse me? – My plugin does a very, very simple check of the global PHP Variable PHP_VERSION to check the PHP Version, I cant make it anymore simple than that and I certainly do know what I’m doing and there is no bug.

    It seems Bluehost is the issue here so please don’t try to pass the buck.

    Joseph – thanks for letting me know that you finally got this fixed with Bluehost.

    All the best

    Joseph G.

    (@illumination2025)

    Joseph – thanks for letting me know that you finally got this fixed with Bluehost.

    You bet, and as always, wonderful job… keep up the GREAT work!

    Sincerely,

    -j

    I’m not passing the buck, and here’s why.

    if(version_compare(PHP_VERSION, '5.4', '<'))
      return;
    
    ...
    
    /* Internationalise the plugin */
    add_action('plugins_loaded', function() {
      load_plugin_textdomain('responsive-menu', false, basename(dirname(__FILE__)) . '/translations/');
    });

    Obviously you’re checking the PHP constant here. But PHP syntax errors (which this is) happen before any code is executed. The way for you to fix this error is to put all code that isn’t < 5.4 compatible into another file and do something like this.

    if(!version_compare(PHP_VERSION, '5.4', '>')) {
       return;
    } else {
       # load code that would otherwise fatal
       include_once 'otherfile.php';
    }

    The one thing that does seem like it *MIGHT* be a Bluehost problem is that the PHP version seemed to not be switching when Joseph was changing it. But that issue seems to have been resolved by Bluehost tech support.

    Plugin Author Responsive Menu

    (@responsivemenu)

    Hi there,

    It works fine on all systems except those using lower than PHP 5.3 but if someone is still on PHP 5.2 they seriously need to consider their hosting provider.

    All the best

    Of course it does! PHP 5.3 is when closure support was added, hence there’s no syntax error and your code works fine. We don’t disagree on PHP 5.2, but for some its still a requirement. If you want to *properly* handle this case, you will update your code. If you don’t, then you’re acknowledging you don’t care about the user experience for those forced into using 5.2.

    Plugin Author Responsive Menu

    (@responsivemenu)

    Hi there,

    Fair point and yes its because of closure support, I am aware of that (oh no wait I dont know what Im doing so maybe I didnt)…

    Of course I care about users but even WordPress say that 5.2 has reached end of life and has security vunerablities and not to use it.

    In an ideal world no I wouldnt support PHP 5.2 as it is not even supported by PHP and hasnt been for so long I cant believe any hosting company still does.

    I will take your thoughts on board though and hopefully we can get people off of PHP 5.2 ASAP!

    All the best

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘unexpected T_FUNCTION’ is closed to new replies.