ID:               44266
 Updated by:       [EMAIL PROTECTED]
 Reported By:      m dot beyer5 at gmx dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         SimpleXML related
-Operating System: Linux
+Operating System: *
-PHP Version:      5.2.5
+PHP Version:      *
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Short answer no.

SimpleXML is designed in a way that properties map to sub elements or
attributes depending on the current level. So we cannot have some of
those mapping to pure properties. What you want is wrapping SimpleXML
instances in your own class (has-a design).


Previous Comments:
------------------------------------------------------------------------

[2008-02-27 14:07:24] m dot beyer5 at gmx dot de

Description:
------------
Classes inheriting from SimpleXMLElements should be able to have class
properties the same way any other class does.
Currently SimpleXML treats operations on class properties as operations
on the xml part of the object.
There should be a way to adress both seperately.

Reproduce code:
---------------
      class Foo extends SimpleXMLElement
      {
            public $bar;
      }
      
      $str = "<xml></xml>";
      
      $foo = new Foo($str);
      $foo->bar = array();

Expected result:
----------------
Assigning anything to Foo->bar should not affect the XML part but
should be handled as a normal class property.

Actual result:
--------------
SimpleXMLElement tries to interpret the public variable as an XML
Element, causing a warning:

Warning: It is not yet possible to assign complex types to properties


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44266&edit=1

Reply via email to