Viewing 1 replies (of 1 total)
  • I’m trying to figure this out, too.

    I’ve changed that line from:
    $version['spec'] = $subver[1];
    to
    $version['spec'] = isset($subver[1]) ? $subver[1] : NULL;

    Still testing, not guaranteed to work.

    My process:
    Here is the function in admin.class.php that includes line 129:

    public function getWpVersion() {
          global $wp_version;
          $version = array();
    
          $ver = explode('.', $wp_version);
          $version['major'] = $ver[0];
          $vc = count($ver);
          if($vc == 2) {
            $subver = explode('-', $ver[1]);
            $version['minor'] = $subver[0];
            $version['spec'] = $subver[1];
            $version['str'] = $version['major'].'.'.$version['minor'].((!empty($version['spec'])) ? ' ('.$version['spec'].')' : '');
          }
          else {
            $version['minor'] = $ver[1];
            $version['build'] = $ver[2];
            $version['str'] = $wp_version;
          } 
    
          return $version;
        }

    What I notice is that $wp_version is “3.5” in the latest WP.
    $ver is an array of the version parts (as separated by ‘.’), e.g. array(3, 5).

    $vc therefor equals 2.

    $subver is trying to create an array of the “5” part of “3.5”, splitting at “-” which doesn’t exist, so we have $subver = array(5) and $subver[1] doesn’t exist (illegal offset).

    I’m not sure where this is being called, but it’s safe to assume that $version (the returned variable) needs to be an array, so we can’t just assign $version the value of $wp_version.

    We can do a shorthand conditional statement instead, assigning $version[‘spec’] the value NULL if $subver[1] is not set.

Viewing 1 replies (of 1 total)
  • The topic ‘Update to wordpress’ is closed to new replies.