Requests, feedback, and general discussion about WoWRoster
DO NOT post topics about WoWRoster AddOns here!


Postby tuigii » Wed Dec 03, 2008 11:40 am

When switching to rs_mode = Off (DIV container mode),
( or )
isn't giving any usefull information, like now (when posting this) - Blizzard took the site down for maintenance - some php errors are shown :
Notice line 197: Undefined property: SimpleClass::$channel
Notice line 197: Trying to get property of non-object
Warning line 197: Invalid argument supplied for foreach()

Somewhat normal, accessing Blizzard's site doesn't give a "file not found" error now but a nice page that explains that the site is down. Good.
So, urlgrabber is doing it's job, and NOT returning false.

In realmstatus.php, line 117, the $xmlsource is parsed with this info, but it contains anything but a valid XML source.
The XML isn't return an error neither...

Statements like this, just after all this :
foreach( $simpleParser->data->rs->r.....
(for US)
foreach( $simpleParser->data->channel->item
(for EU)
will provoke the error as shown, the keys used here ('r' and 'item' and upper keys) do not exists in the class property SimpleParser->data .....

Question : the presence of a key, like 'r' or 'item', should be checked for presence to see if the XML parsing returns a usable result.
Something like
if (array_key_exists_r('item',$simpleParser))
right after the $region == 'US' (same thing goes for the $region == 'EU' case.

Function to add :
Code: Select all
function array_key_exists_r($needle, $haystack)
    $result = array_key_exists($needle, $haystack);
    if ($result) return $result;
    foreach ($haystack as $v) {
        if (is_array($v)) {
            $result = array_key_exists_r($needle, $v);
        if ($result) return $result;
    return $result;

More info :

I confirm that no more php errors are shown right now, and post back when I got the results when the
is up again, to see if the check return true in that case (and parsing will continue).

Btw, in "rs_mode = On" mode, the error doesn't show.
Normal, realmstatus is being called as an path to an image, generating it dynamicly, like : ... Khaz+Modan
User avatar
tuigii Master Master
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Return to General Support & Feedback

Who is online

Users browsing this forum: No registered users and 0 guests