Bug #70001 [NEW]: overwrite DOMElement textContent properties with trimming

From: Date: Mon, 06 Jul 2015 12:35:50 +0000
Subject: Bug #70001 [NEW]: overwrite DOMElement textContent properties with trimming
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194155@lists.php.net to get a copy of this message
From:             2detaz at protonmail dot ch
Operating system: Linux Debian 7.5 Wheezy
PHP version:      5.6.10
Package:          DOM XML related
Bug Type:         Bug
Bug description:overwrite DOMElement textContent properties with trimming

Description:
------------
Version : PHP 5.6.10-1~dotdeb+7.3 (cli) (built: Jun 15 2015 07:22:09) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend
Technologies

DomNode::textContent is readonly on the php doc
http://php.net/manual/en/class.domnode.php#domnode.props.textcontent.
As
excepted on php5.4.42, the script returns the good result. But on
php5.6, the textContent is not readonly and I don't know why PHP does
some HTML entity encoding (that's weird) instead of emitting an error or
a warning.


Test script:
---------------
$element = new DOMText("  Summary for Test DOMText & with a nbsp char
right here .");
var_dump($element->textContent);
$element->textContent = ltrim("  Summary for Test DOMText & with a nbsp
char right here .");
var_dump($element->textContent);

Expected result:
----------------
string(92) "  Summary for Test DOMText & with a nbsp char right
here ."
string(92) "  Summary for Test DOMText & with a nbsp char right
here ."

Actual result:
--------------
string(92) "  Summary for Test DOMText & with a nbsp char right
here ."
string(69) "Summary for Test DOMText & with a nbsp char right
here .".

-- 
Edit bug report at https://bugs.php.net/bug.php?id=70001&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70001&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70001&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70001&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70001&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70001&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70001&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70001&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70001&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70001&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70001&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70001&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70001&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70001&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70001&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70001&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70001&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70001&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70001&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70001&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70001&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#194155) next »