Doc #65442 [Opn->Ver]: Example number 1 code needs fixing.

From: Date: Mon, 16 Dec 2013 21:38:15 +0000
Subject: Doc #65442 [Opn->Ver]: Example number 1 code needs fixing.
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-10711@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65442&edit=1 ID: 65442 Updated by: philstu@php.net Reported by: contactme at antonydandrea dot com Summary: Example number 1 code needs fixing. -Status: Open +Status: Verified Type: Documentation Problem Package: Documentation problem Operating System: Ubuntu PHP Version: Irrelevant -Assigned To: +Assigned To: philstu Block user comment: N Private report: N New Comment: Fixed locally, just waiting on SVN server issues to be resolved before I can commit. Previous Comments: ------------------------------------------------------------------------ [2013-08-13 14:01:12] contactme at antonydandrea dot com Description: ------------ --- From manual page: http://www.php.net/example.xml-structure --- Example one that shows an example usage throws an undefined index. This is because when it first calls startElement, $depth[$parser] does not get initialised. To fix this, I changed the startElement function to function startElement($parser, $name, $attrs) { global $depth; if (isset($depth[$parser])) { for ($i = 0; $i < $depth[$parser]; $i++) { echo " "; } } else { $depth[$parser] = 0; } echo "$name\n"; $depth[$parser]++; } Would be good to add this improvement to the documentation. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65442&edit=1

« previous php.doc.bugs (#10711) next »