ID:               33986
 Updated by:       [EMAIL PROTECTED]
 Reported By:      kulev dot vladimir at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         SimpleXML related
 Operating System: Gentoo Linux
 PHP Version:      5.1.0b3
 New Comment:

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

$str = $root->node; 
echo "'" . $str{0} . "'<br/>\n"; 
is the same as 
echo "'" . $str[0] . "'<br/>\n"; 
so the first node is fetched whos value is "data". 
$str[1]'s value NULL since there's only one node. 


Previous Comments:
------------------------------------------------------------------------

[2005-08-03 21:04:44] kulev dot vladimir at gmail dot com

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 this bug report at http://bugs.php.net/?id=33986&edit=1

Reply via email to