#181 ✓resolved
semias

SiteInvoice - invoices

Reported by semias | March 16th, 2011 @ 02:33 PM | in 5.0.4 (closed)

Open the tools >> siteinvoice app and the following error occurs

Warning: Invalid argument supplied for foreach() in /home/semias/public_html/github.sitellite.nl/inc/app/siteinvoice/lib/PEAR/Services/ExchangeRates/Currencies_UN.php on line 78

Warning: Invalid argument supplied for foreach() in /home/semias/public_html/github.sitellite.nl/inc/app/siteinvoice/lib/PEAR/Services/ExchangeRates.php on line 231

Comments and changes to this ticket

  • semias

    semias March 16th, 2011 @ 02:37 PM

    Where is the install/siteinvoice/index.php used for?

  • semias

    semias March 18th, 2011 @ 04:29 AM

    • State changed from “open” to “resolved”

    Cause: A foreach loop is executed according to the following parameters:

    foreach($array as $key => $value) { actions; }
    

    If $array is empty/null, it results in a warning because a system simply cannot assign values to non-existing keys.

    Solution: To fix these types of issues, a simple if loop has to be added before the foreach loop is executed to check whether or not $array is empty.

    if ($array) { 
        foreach($array as $key => $value) { 
            actions; 
        } 
    }
    

    This means the foreach loop will be skipped altogether if $array is empty/null.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Sitellite web content management system.

People watching this ticket

Pages