-2

[29-Jul-2018 21:05:03 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361 [29-Jul-2018 21:05:04 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361 [29-Jul-2018 21:07:23 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361 [29-Jul-2018 21:07:24 UTC] PHP Notice: Undefined variable: statusCode in /home2/postgram/public_html/app/vendor/mgp25/instagram-php/src/Utils.php on line 361

how to fix it? this sc https://raw.githubusercontent.com/mgp25/Instagram-API/master/src/Utils.php

  • 3
    I dunno.... define `$statusCode` before it is used on line 361 maybe? – Simon K Jul 29 '18 at 21:17
  • 1
    It is the same error, we'd only need to see it once. We don't need +1100 lines of code. Just post line 361, but more than likely the dup should resolve it. – user3783243 Jul 29 '18 at 21:20
  • 1
    Possible duplicate of [PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) – user3783243 Jul 29 '18 at 21:20

1 Answers1

0

Code of function is:

public static function checkFFPROBE()
{
    // We only resolve this once per session and then cache the result.
    if (self::$ffprobeBin === null) {
        @exec('ffprobe -version 2>&1', $output, $statusCode);
        if ($statusCode === 0) {     // <-- line nr 361
            self::$ffprobeBin = 'ffprobe';
        } else {
            self::$ffprobeBin = false; // Nothing found!
        }
    }

    return self::$ffprobeBin;
}

You dont get error, it is just a php notice. exec() as 3rd argument return status of the executed command (see more exec )

I think, you can resolve it in 3 ways:

  1. Declare $statusCode just before 361 line ( e.g. $statusCode = null; )

  2. Change exec() to shell_exec() ( see more shell_exec )

  3. You can ignore php notices by setting error reporting level error_reporting( E_ALL & ~E_NOTICE );

colorgreen
  • 265
  • 1
  • 2
  • 12