Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

PHPStorm picking up 3 errors in library/core/functions.general.php

edited September 2015 in Vanilla 2.0 - 2.8

I'm using Vanilla 2.1.11, and I'm not sure if I caused these errors, or if this is the way the code is supposed to be, but PHPStorm is telling me there are 3 errors in this file library/core/functions.general.php. The first two are on lines 812 and 813, where it is telling me "undefined variable i" on line 812, and then it is saying "cannot break/continue 1 level(s)" on line 813:

     // Page Images
     if (count($PageInfo['Images']) == 0) {
        if ($i > 10)
           break;

        list($Width, $Height, $Type, $Attributes) = getimagesize($Image);
        $Images = DomGetImages($Dom, $Url);
        $PageInfo['Images'] = array_values($Images);
     }

I'm wondering if $i is supposed to be $Image?

The 3rd error is on line 2175, where it is saying "undefined variable Post"

     // Make the request
     $Pointer = @fsockopen($Host, $Port, $ErrorNumber, $Error, $Timeout);
     if (!$Pointer)
        throw new Exception(sprintf(T('Encountered an error while making a request to the remote server (%1$s): [%2$s] %3$s'), $Url, $ErrorNumber, $Error));

     $Request = "HEAD $Path?$Query HTTP/1.1\r\n";

     $HostHeader = $Host.($Post != 80) ? ":{$Port}" : '';
     $Header = array(
        'Host'            => $HostHeader,
        'User-Agent'      => ArrayValue('HTTP_USER_AGENT', $_SERVER, 'Vanilla/2.0'),
        'Accept'          => '*/*',
        'Accept-Charset'  => 'utf-8',
        'Referer'         => $Referer,
        'Connection'      => 'close'
     );

I am wondering if $Post is supposed to be $Port?

The forum seems to be working 100% fine, but I'm surprised PHPStorm started displaying these errors - pretty sure it wasn't happening earlier today.

Comments

  • peregrineperegrine MVP
    edited September 2015

    in 2.1.11 they are typo errors, and lingering break code.

    you can always check github to see if something is fixed.

    it is fixed in 2.2b1 apparently.

    In any event I think its good to report stuff on this forum, since people might never look at github.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I changed $Post to $Port on line 2175, and then I just erased the if($i > 10) and break; on lines 812-813 since the $i wasn't getting defined, and I don't think it was supposed to be the $Images variable as that looks like it's an associative array and not a number.

    I'm looking forward to 2.2 coming out. Any timeline for that happening?

  • peregrineperegrine MVP
    edited September 2015

    and yet another person (gratiafide) asked the perennial question: Any timeline for that happening?

    Try to divine the answer yourself by reading this announcement and see if you can make an estimate yourself. then if it comes true, you can pat yourself on the back.

    http://vanillaforums.org/discussion/30187/vanilla/p1

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited September 2015

    Sorry for not reading more carefully - I guess it says this: "Currently expect both rc & gold will hit in August. Any assistance looking at the 2.2 milestone list on GitHub would be greatly appreciated."

Sign In or Register to comment.