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
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 !
Your email address:
MUST BE VALID
Solve the problem:
1 + 29 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 22:01:28 2024 UTC