ID: 44768
User updated by: sathia dot musso at gmail dot com
Reported By: sathia dot musso at gmail dot com
Status: Bogus
Bug Type: DOM XML related
Operating System: linux
PHP Version: 5.2.5
New Comment:
this should help to understand, in Javascript you can access this
strange attribute
<textarea id="pippo"></textarea>
<script>
document.getElementById('pippo').value = "<embed embed>";
alert(document.getElementById('pippo').value);
</script>
this work as expected, in php you can't do that.
(i know that javascript is a client side script, I use it just as an
example of a DOM abstraction)
Previous Comments:
------------------------------------------------------------------------
[2008-04-18 11:55:15] sathia dot musso at gmail dot com
I can't understand what "expected thing" should be.
I agree that the dom parser sees the textarea,
but if the textarea content is wrapped within < and > there is no way
to read its content.
<textarea><img src="foobar" /></textarea>
In javascript if you set the value of a textarea to be "xxx" it's
filled correctly even if the attribute value does not exists in the
textarea tag
thank you for your time
------------------------------------------------------------------------
[2008-04-18 04:42:01] [EMAIL PROTECTED]
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
If there's no attribute "value" then there's nothing to print then
there's no output.
print $textarea->nodeName;
instead of
print $textarea->getAttribute("value");
does produced some expected thing.
------------------------------------------------------------------------
[2008-04-17 22:51:51] sathia dot musso at gmail dot com
Description:
------------
I know there's no such attribute value="" but you can't access the
content ($textarea->textContent will not work as well) of that if the
content inside is wrapped within "lt" and "gt" <textarea><won't
read></textarea> (ie when you read embed tags from textarea)
Reproduce code:
---------------
$documentx = new DOMDocument();
$documentx->loadHTML($data);
$textareas = $documentx->getElementsByTagName("textarea");
foreach($textareas AS $textarea){
print($textarea->getAttribute("value"));
}
<textarea><img src="foobar" /></textarea>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44768&edit=1