Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0RC3

Bug #766 parse error: use of 'clone' keyword as method name
Submitted: 2004-02-16 04:10 UTC
From: hlellelid Assigned: davey
Status: Closed Package: XML_Tree
PHP Version: 5.0.0b4 (beta4)+ OS: All
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 35 - 10 = ?

 [2004-02-16 04:10 UTC] hlellelid
Description: ------------ I assume you know about this issue, but I figured I'd add it anyway so that it's on a to-do list (and so that I know when I can start using XML_Tree w/ PHPUnit). I discovered this bug because it is causing PHPUnit, which includes XML_Tree w/ error supression (@), to die quietly. Reproduce code: --------------- any include of XML_Tree in PHP >= 5.0.0b4 Actual result: -------------- Parse error: parse error, expecting `T_STRING' in /usr/local/lib/php/XML/Tree.php on line 333


 [2004-04-15 04:35 UTC] djpenton at cs dot mu dot oz dot au
There are two problem locations: Tree.php and Tree/Node.php Just run the following through vim "%s/clone/clone_is_a_protected_keyword/g" :-) Should work then. Cheers, Dave
 [2004-04-26 15:15 UTC] alan_k
yeap - clone is a reserved word - this need fixing ..
 [2004-05-15 13:21 UTC] davey
I did an s/clone/cloneTree/ in both these files, seems like a good name for it... As 2.0 is a new major version, and this is all thats needed to make the package work in PHP5, I would suggest, even though its beta, to break the API... Or you could do: if (version_compare('5.0.0',phpversion()) === 1) { function clone (...) { .... } } else { function cloneTree(...) { .... } } Ugly but at least its not an API break in PHP4 where XML_Tree is undoubhtedly already in production use... - Davey
 [2004-05-15 14:14 UTC] davey
Renamed XML_Tree::clone() to XML_Tree::cloneTree() and XML_Tree_Node::clone() to XML_Tree_Node::cloneNode() - included in my uber patch. - Davey