Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    49
    Plugin Contributions
    0

    Default New Version Available code doesn't handle error return from getProjectVersion

    In order to avoid the behavior reported in New Version Available: v{.{ :: {, when error information is returned by getProjectVersion() the code in admin/includes/header.php should display the error information instead of attempting to extract and display version information. This would be an immense help when CURL is not configured properly.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: New Version Available code doesn't handle error return from getProjectVersion

    Quote Originally Posted by dennisns7d View Post
    In order to avoid the behavior reported in New Version Available: v{.{ :: {, when error information is returned by getProjectVersion() the code in admin/includes/header.php should display the error information instead of attempting to extract and display version information. This would be an immense help when CURL is not configured properly.
    What error information was provided that could be evaluated to support the requested action?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jan 2010
    Posts
    49
    Plugin Contributions
    0

    Default Re: New Version Available code doesn't handle error return from getProjectVersion

    I've done a bit more digging into the code and determined that the code in admin/includes/header.php is expecting getProjectVersion() to always return an array. The code in admin/includes/classes/VersionServer.php returns a string in the event of a CURL error. To correct this, change line 46 of admin/includes/classes/VersionServer.php from
    Code:
                return $this->formatCurlError($errno, $error);
    to
    Code:
                return json_decode($this->formatCurlError($errno, $error), true);
    To avoid incorrectly reporting that the version is current when in reality a CURL error was encountered, change lines 89-95 of admin/includes/header.php from
    Code:
        if (isset($newinfo['error'])) {
            $isCurrent = true;
            $versionCheckError = true;
        } else {
            $isCurrent = $versionServer->isProjectCurrent($newinfo);
        }
    to
    Code:
        if (isset($newinfo['error'])) {
            $isCurrent = true;
            $versionCheckError = true;
            $new_version = '';
        } else {
            $isCurrent = $versionServer->isProjectCurrent($newinfo);
        }
    I found it strange to not report the error unless a version check was specifically requested via the vcheck flag was set, so I changed line 121 of admin/includes/header.php from
    Code:
    if (!$doVersionCheck || ($versionCheckError && $version_check_requested == true)) {
    to
    Code:
    if (!$doVersionCheck || $versionCheckError) {
    With these changes, a CURL error will result in 'Error: Could not contact Project Version Server' being displayed instead of 'v{.{ :: {';

  4. #4
    Join Date
    Jan 2010
    Posts
    49
    Plugin Contributions
    0

    Default Re: New Version Available code doesn't handle error return from getProjectVersion

    To display the CURL error information, change the code in near line 125 from
    Code:
        if ($versionCheckError) {
            $new_version = ERROR_CONTACTING_PROJECT_VERSION_SERVER . '<br>';
        }
    to
    Code:
        if ($versionCheckError) {
            $new_version = ERROR_CONTACTING_PROJECT_VERSION_SERVER . '<br>' . $newinfo['error'] . '<br>';
        }
    In my test case, the CURL error information is 'SSL certificate problem: self signed certificate in certificate chain[60]'. Configuring PHP to use a cacert.pem file cures this particular problem.

 

 

Similar Threads

  1. v155 New Version Available: v{.{ :: {
    By RobRiv in forum Upgrading to 1.5.x
    Replies: 11
    Last Post: 25 Apr 2018, 08:36 PM
  2. How do I get my new payment module to check the return code?
    By hasnut in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 4 Jun 2010, 08:52 PM
  3. Admin message: New Version Available v1.3.9b
    By thinkdeal in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 4 May 2010, 09:20 PM
  4. How to handle core return credit products?
    By StickyC in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 28 Oct 2009, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg