XML_Tree error in PHP5

From: Date: Thu, 28 Apr 2005 17:43:49 +0000
Subject: XML_Tree error in PHP5
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18997@lists.php.net to get a copy of this message
I try this code with PHP 5.0.3 Pear: XML_Parser 1.2.6 stable XML_Tree 1.1 stable <?php require_once('XML/Tree.php'); $xt = XML_Tree::getTreeFromFile('data.xml'); if (PEAR::isError($xt)){ echo "ERROR: When loading XML File."; return; } echo "OK.\n"; $xt->dump(); ?> But i get the next error. Parse error: parse error, unexpected T_CLONE, expecting T_STRING in /usr/local/lib/php/XML/Tree.php on line 297 goint to that line we see: function clone() { Going to http://www.php.net/manual/en/language.oop5.cloning.php reveals that in PHP5 the clone keyword is reserved and to clone we declare a __clone. Just comenting the clone function, and retest but we get: Parse error: parse error, unexpected T_CLONE, expecting T_STRING in /usr/local/lib/php/XML/Tree/Node.php on line 112 Comenting that clone too. Now we get the next error: Fatal error: Using $this when not in object context in /usr/local/lib/php/XML/Tree.php on line 189 This is a more complex error, to fix we need to study the wait the class is implemented and making the fixes, but it requires more time than available for me now, and is not good waste a lot time in patches. So XML_Tree as several other PEAR packages are targeting PHP4, what options does the PEAR comunity are proposing to port PEAR packages to use the PHP5 OOP capabilities, public, private, static, exception handling instead of PEAR_Error, etc. One way could be writing wrappers to all clases, for example a XML_Tree5 that uses XML_Tree or write PHP5 version of packages wich is cleaner and makes the code more professional. Any ideas? --------------------------------------------------------------------------- No importa cuanto se resistan, al final todos seran convertidos a unix ... Los usuarios de Mac ni se preocupen porque ya lo estan aún sin saberlo ... _________________________________________________________ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com

« previous php.pear.general (#18997) next »