Re: DOMNode children iteration (was Re: array() returns something weird)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 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.

> and the script returns the attached file.

Do you mean it returns what is in the output file _I_ have attached, or did 
_you_ try to attach something? If that is the case, then your attachment 
didn't get through.

> It looks like a bogus bug?

I am certain it _is_ a genuine bug. For example, in PHP when you write:

	$foo = array();
	echo gettype($foo);

the output should not be NULL, but in my example script (unmodified, with 
iteration by reference) things like this start happening at some point.

Regards,
Szczepan Hołyszewski

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux