php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60323 Extended DOMDocument will change to unextended DOMDocument on context change
Submitted: 2011-11-17 22:06 UTC Modified: 2013-12-03 09:09 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gmblar+php at gmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.3.8 OS: MacOSX
Private report: No CVE-ID: None
 [2011-11-17 22:06 UTC] gmblar+php at gmail dot com
Description:
------------
Extended DOMDocument will change to unextended DOMDocument on context change


Test script:
---------------
<?php

class Document extends DOMDocument {
}

function foo() {
    $document = new Document();
    $element  = $document->appendChild($document->createElement('div'));
    var_dump($element->ownerDocument instanceOf Document);
    return $element;
}

$element = foo();
var_dump($element->ownerDocument instanceOf Document);


Expected result:
----------------
bool(true)
bool(true)


Actual result:
--------------
bool(true)
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-03 09:09 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-12-03 09:09 UTC] mike@php.net
You have to register your subclass:

$document->registerNodeClass("DOMDocument", "Document");
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 20:01:29 2024 UTC