php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33589 Subclassing DOMXML-Classes don't work
Submitted: 2005-07-06 14:48 UTC Modified: 2005-07-06 15:35 UTC
From: timo dot hummel at 4fb dot de Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 4.3.11 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 !
Your email address:
MUST BE VALID
Solve the problem:
44 - 3 = ?
Subscribe to this entry?

 
 [2005-07-06 14:48 UTC] timo dot hummel at 4fb dot de
Description:
------------
Subclassing the classes provided by the DOMXML-Extension doesn't work. The usual approach building object-oriented applications is that the developer can subclass classes to save work and increase reliabilty of their applications.

DOMXML doesn't seem to support that, see the reproduce code below.

Of course, a developer could create a private property of the class TestElement and assign DomElement to this, but this is not the idea behind classes and objects and should be avoided (as this would also cause problems with multiple specialisation of classes, e.g. if TestElement would be specialized more);

Reproduce code:
---------------
Test case:

<?php

class TestElement extends DomElement
{
  function TestElement
  {
    /* This doesn't work */
    DomElement::DomElement("test");

    /* This also doesn't work */
    parent::DomElement("test");
  }
}

?>

However, this works:

<?php

$element = new DomElement("test");

?>



Actual result:
--------------
Warning: domelement(): Underlying object missing in <file>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-06 15:35 UTC] chregu@php.net
indeed, does not work in PHP 4.x. Never did, never will. Use 
PHP 5, where you can do that (with some reservation, but does 
work)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC