ID:          43107
 Updated by:  [EMAIL PROTECTED]
 Reported By: php at benjaminschulz dot com
-Status:      Open
+Status:      Assigned
 Bug Type:    DOM XML related
 PHP Version: 5.3CVS-2007-10-26 (CVS)
-Assigned To: 
+Assigned To: chregu
 New Comment:

Assigned to the maintainer.


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

[2007-10-26 07:02:09] php at benjaminschulz dot com

Description:
------------
I need to restrict the direct setting of DOM* properties to ensure that
no non-utf8 encoding is getting into the Document because libxml2
(ext/dom?) still can't handle that. Implementing this i discovered that
classes derived from DOM* cannot restrict the access level of
properties.
I think there should at least be an error raised telling that it is not
allowed to change the access level of properties, but because of
libxml's great  segfaulting abilities i would prefer to able to restrict
the access (without a magic setter). Another solution for the encoding
problem might be to just check _all_ incoming strings into the
DomDocument for unicode if the documents encoding is UTF-8.

Reproduce code:
---------------
<?php
class Test extends DomDocument {
    protected $textContent;   
}

$test = new Test;
$test->loadXml('<foo>bar</foo>');
var_dump($test->textContent);

Expected result:
----------------
Fatal Error: Cannot access protected property Text::$textContent

Actual result:
--------------
string(3) "bar" 


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


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

Reply via email to