php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54991 domimplementation instance is not a reference inside domdocument
Submitted: 2011-06-04 11:33 UTC Modified: 2019-09-22 23:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: giorgio dot liscio at email dot it Assigned: beberlei (profile)
Status: Wont fix Package: DOM XML related
PHP Version: 5.3.6 OS: any?
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giorgio dot liscio at email dot it
New email:
PHP Version: OS:

 

 [2011-06-04 11:33 UTC] giorgio dot liscio at email dot it
Description:
------------
hi, there is a strange behavior with domimplementation and its reference inside domdocument: i can't determine if a domdocument is bound to a specific implementation, because

$implementation = new \DOMImplementation();
$doc = $implementation->createDocument();
var_dump($doc->implementation === $implementation);

// should be true, but it is false
	


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-04 13:00 UTC] giorgio dot liscio at email dot it
class MyImplementation extends \DOMImplementation
{
	function commonfunc()
	{
		echo "implementation";		
	}
}

$implementation = new MyImplementation();
$doc = $implementation->createDocument();
var_dump($doc->implementation === $implementation);
// raises error:
//doc->implementation->commonfunc();
 [2013-12-03 09:52 UTC] mike@php.net
-Status: Open +Status: Analyzed
 [2013-12-03 09:52 UTC] mike@php.net
.) the objects created by DOMImplementation->create* do not reference the implementation
.) dom_document_implementation_read() always creates a new DOMImplementation object
 [2019-09-22 23:00 UTC] beberlei@php.net
-Status: Analyzed +Status: Wont fix -Assigned To: +Assigned To: beberlei
 [2019-09-22 23:00 UTC] beberlei@php.net
ext/dom doesn't guarantee reference equality, new instances are often created from properties that behave more like "magic" __get returning new instances based on underlying data.

For this case though, PHP DOMImplementation doesn't support any other implementation than the one in code. Also don't trust hasFeature on it, because that data is just hardcoded.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:21 2019 UTC