ID: 43107 User updated by: php at benjaminschulz dot com Reported By: php at benjaminschulz dot com Status: Wont fix Bug Type: DOM XML related PHP Version: 5.3CVS-2007-10-26 (CVS) Assigned To: rrichards New Comment:
"DOM properties can't be overridden because there would then be no way to access the underlying functionality." That's exactly the point - i don't want some functionality to be accessed. If i would want to use the DomDocument as it is i won't need to extend it, right? Previous Comments: ------------------------------------------------------------------------ [2007-11-14 16:00:30] [EMAIL PROTECTED] First off you can't make the visibility of properties stricter. DOM properties can't be overridden because there would then be no way to access the underlying functionality. I don't see a way to provide any warnings for this, due to how the way properties are implemented in DOM, so just comes down to the fact that you cant override DOM properties and to validate your input. ------------------------------------------------------------------------ [2007-11-13 06:42:56] [EMAIL PROTECTED] Rob, can you look into that? I have no idea about that part of code, not even if it's possible :) ------------------------------------------------------------------------ [2007-11-12 10:12:08] [EMAIL PROTECTED] Assigned to the maintainer. ------------------------------------------------------------------------ [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