#33986 [NEW]: Using $simpleXMLElement->node as string cause bug
| From: | kulev dot vladimir at gmail dot com | Date: | Wed, 03 Aug 2005 19:04:44 +0000 |
| Subject: | #33986 [NEW]: Using $simpleXMLElement->node as string cause bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-82907@lists.php.net to get a copy of this message | ||
From: kulev dot vladimir at gmail dot com
Operating system: Gentoo Linux
PHP version: 5.1.0b3
PHP Bug Type: SimpleXML related
Bug description: Using $simpleXMLElement->node as string cause bug
Description:
------------
Maybe it's ok, because $root->node is not a string, but object.
But then PHP must return error when trying to do so, I think.
Reproduce code:
---------------
<?
$xml = "<root><node>data</node></root>";
$root = simplexml_load_string($xml);
$str = $root->node;
echo "'" . $str . "'<br/>\n";
echo "'" . $str{0} . "'<br/>\n";
echo "'" . $str{1} . "'<br/>\n";
$str = strval($root->node);
echo "'" . $str . "'<br/>\n";
echo "'" . $str{0} . "'<br/>\n";
echo "'" . $str{1} . "'<br/>\n";
?>
Expected result:
----------------
'data'
'd'
'a'
'data'
'd'
'a'
Actual result:
--------------
'data'
'data'
''
'data'
'd'
'a'
--
Edit bug report at http://bugs.php.net/?id=33986&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33986&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33986&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33986&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33986&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33986&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33986&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33986&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33986&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33986&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33986&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33986&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33986&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33986&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33986&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33986&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33986&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33986&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33986&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33986&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33986&r=mysqlcfg