> -----Original Message----- > From: Szczepan Hołyszewski [mailto:webmaster@xxxxxxxxxxxxxx] > Sent: 26 August 2009 08:48 > > Martin Scotta wrote: > > > Fatal error: Call to a member function getAttribute() on a non- > object in > > testme.php on line *121* > > Yes, this is _how_ the unmodified script errors out. It is not shown > in the > output I attached in my previous message because display_errors is > Off in my > php.ini, and the line that sets it to On in my script is commented > out. > > > I'm using a Apache/2.2.3 (Win32) PHP/5.2.6 > > I am not using Apache at all. The same error can be seen when I run > the script > directly through php on the command line. > > > Is the script correctly? I have removed the "&" in the loop I really can't see why you'd want to use references in the posted loop anyway -- it's not likely to gain you any performance, and, as I understand it, may actually run more slowly than the non-reference version. > I know that iterating a DOMNode's children using firstChild and > nextSibling by > reference causes trouble, thank you. The problem is that it causes > trouble > with objects unrelated to the loop itself, e.g. to variables defined > _after_ > the loop has terminated. I don't think it's possible to answer this for sure without seeing more of the code -- at least the complete body of the loop, plus as far as any further use of the variable $child (and any other variables assigned from it). Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, C507, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.ford@xxxxxxxxxxxxxx Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm