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
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: timo dot hummel at 4fb dot de
New email:
PHP Version: OS:

 

 [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: Fri May 10 23:01:30 2024 UTC