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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
21 + 22 = ?
Subscribe to this entry?

 
 [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: Mon Nov 18 11:01:30 2019 UTC