Doc #61302 [NEW]: SimpleXML documentation has an error.
| From: | timothy at green dot name | Date: | Tue, 06 Mar 2012 17:13:09 +0000 |
| Subject: | Doc #61302 [NEW]: SimpleXML documentation has an error. | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8027@lists.php.net to get a copy of this message | ||
From:
Operating system: Fedora Linux
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:SimpleXML documentation has an error.
Description:
------------
---
From manual page: http://www.php.net/simplexml.examples-basic
---
The documentation reads:
$movies = new SimpleXMLElement($xmlstr);
echo $movies->movie[0]->plot;
The above example will output:
So, this language. It's like, a programming language. Or is it a
scripting language? All is revealed in this thrilling horror spoof
of a documentary.
No. That example will not output that. It outputs a SimpleXML Object. You
need to cast it to a string to get that output. The documentation should
make this clearer.
Test script:
---------------
<?php
header('Content-Type: text/plain');
$movies = file_get_contents('sample.movies.xml');
$xml = new SimpleXMLElement($movies);
$plot = (string)$xml->movie->plot;
var_dump($plot);
foreach ($plot as $v) {
var_dump($v);
}
exit(__FILE__ . ': ' . __LINE__);
--
Edit bug report at https://bugs.php.net/bug.php?id=61302&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61302&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61302&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61302&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61302&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61302&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61302&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61302&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61302&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61302&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61302&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61302&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61302&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61302&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61302&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61302&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61302&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61302&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61302&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61302&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61302&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61302&r=mysqlcfg