php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22295 Again MS XML DOM Error
Submitted: 2003-02-19 04:56 UTC Modified: 2003-02-20 05:34 UTC
From: vodmal at newmail dot ru Assigned:
Status: Closed Package: COM related
PHP Version: 4CVS-2003-02-19 (stable) OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vodmal at newmail dot ru
New email:
PHP Version: OS:

 

 [2003-02-19 04:56 UTC] vodmal at newmail dot ru
I'am locate error! :-)

Look this source code:
test.php
===========
<?
function a()
{
		$xml = new COM("Msxml2.DOMDocument.4.0") or die("Can't instance Microsoft.XMLDOM");
		$xml->async = false;

		$isXmlLoaded = $xml->load("D:\\Inetpub\\wwwroot 333\\mail\\test.xml");

		if (!$isXmlLoaded) {
			die("Can't load XML");
		}

		$items = $xml->selectNodes('//item');

		//echo $items->length;\/
		for ($i=0;$i<$items->length;$i++)
		{

			$item = &$items->item($i);

			getAttribute($item,"att");
			echo "Ok!";flush();
			getAttribute($item,"nonexistenceattributename");
			echo "OK?";flush();
			echo "<BR>";
		}

}


function getAttribute(&$node,$name)
{
	$attrib = $node->attributes->getNamedItem($name);
	$value = $attrib->nodeValue;
	return $value;
}

a();
?>
===========

test.xml
===========
<?xml version="1.0"?>

<content>
	<item att="test"/>
</content>
===========

Error appear when i'am try to get attribute by name for no existence attribute.

I hope, that my bug-example help you locate bug.

And one question: how i can query interface IXMLDOMElement in PHP for IXMLDOMNode element?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-20 05:34 UTC] phanto@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC