From: php at benjaminschulz dot com
Operating system:
PHP version: 5.3CVS-2007-10-26 (CVS)
PHP Bug Type: DOM XML related
Bug description: access level of DOM* properties are not applied
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 bug report at http://bugs.php.net/?id=43107&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43107&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43107&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43107&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43107&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43107&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43107&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43107&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43107&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43107&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43107&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43107&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43107&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43107&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43107&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43107&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43107&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43107&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43107&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43107&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43107&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43107&r=mysqlcfg