WHMCS PDF Invoice Download error (PHP Fatal error)

Hello!

When I click on "Download" on an invoice, instead of downloading PDF, I see the following error:

Fatal error: Cannot use object of type WP_Error as array in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 721

  • Michael Bissett

    Hey @Maxim, hope you're doing well today! :slight_smile:

    Hmm... could you try replacing this line in your wp-config.php:

    define('WP_DEBUG', false);

    With this:

    // Enable WP_DEBUG mode
    define('WP_DEBUG', true);
    
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors',0);

    And then try downloading that file again? And after you do that, could you please post the results of the debug.log file here please?

    Kind Regards,
    Michael

  • Maxim

    Thank you for your answer.
    Here are the debug.log file contents:

    [01-Jan-2015 12:52:27 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:27 UTC] PHP Notice:  Undefined variable: url in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:27 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:47 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:47 UTC] PHP Notice:  Undefined variable: url in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:47 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:51 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:51 UTC] PHP Notice:  Undefined variable: url in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:51 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:55 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:55 UTC] PHP Notice:  Undefined variable: url in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:55 UTC] PHP Notice:  Undefined variable: parts in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 213
    [01-Jan-2015 12:52:56 UTC] PHP Fatal error:  Cannot use object of type WP_Error as array in /home/minunetw/public_html/wp-content/plugins/whmcs-wordpress-integration/whmcs-integration.php on line 721
  • Jose

    Hi @Maxim,

    Was struggling around this for a while but still can't make it work as it should.

    I fixed the Fatal error and the Notices.
    As a temporary workaround, it will fallback to a redirect so that the PDF can be downladed from the WHMCS install. It will require the user to log again though.

    Could you please confirm if this was working fine before?
    If so, did you change some configuration in your server or installed/updated something in your site?
    This might be related to the gzip compression settings in your server, but it is just a guessing.
    The download works fine when you open it directly from WHMCS, but it fails when it is requested from the integration via cURL.

    Please advise.

    Cheers,
    Jose

  • Jose

    Well, if you are already logged in WHMCS the download will work without issues.
    But, if you logout from WHMCS and try to downlad the file again, it will redirect you to the WHMCS login page before downloading the file.

    Again, the original issue is related to some configuration on your server, so I can do much from the plugin code. If this workaround works fine for you, that would be great :slight_smile:

    Cheers,
    Jose

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.