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
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: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [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: Sat Apr 20 00:01:27 2024 UTC