Re: Undefined index....

From: Date: Fri, 15 Mar 2013 13:21:29 +0000
Subject: Re: Undefined index....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-320573@lists.php.net to get a copy of this message
Jay Blanchard wrote:
I have inherited a mess of a home-grown PHP framework that literally fills the error_log with 100's of thousands of messages each day. First order of business was rotating the logs, now we are working through each error to solve them. This is a fairly basic error, but I for the life of me cannot remember what the solution is. I have a recursive function that reads from XML files and replaces xi: include directives. It looks like this - function includeXML($file, $locale, $url, $level = 1) {
     // stuff
$xml = ''; Should work here ... Since the call below is ADDING to $xml you do need something existing to add to so what does that give?
     while(($line = fgets($fp)) !== false) {
         if($pos === false) {
             $xml .= $line;
         } else {
             includeXML('repository/' . $included, $locale, (int)$level + $pos -
1);
         }
     }
} Why do I get the notice that $xml is an undefined index? I do not want to suppress the notice, I just want to take care of it properly. I attempted setting $xml within the function but then the whole function fails for some reason in the depths of this hideous framework. Can anyone provide any insight? TVMIA!
-- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

« previous php.general (#320573) next »