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

Bug #14761 do {} while () syntax messes up control sequence
Submitted: 2008-10-08 14:53 UTC
From: fidian Assigned: jespino
Status: Closed Package: PHP_Beautifier (version 0.1.14)
PHP Version: 5.2.4 OS: Linux (various)
Roadmaps: (Not assigned)    
Subscription  


 [2008-10-08 14:53 UTC] fidian (Tyler Akins)
Description: ------------ When parsing PHP code that contains a do {} while () syntax, the control sequence is messed up. It pushes the "while" when it hits the token, but doesn't pop the "while" when it hits the semicolon when there were no open/close braces. Test script: --------------- <?PHP function a() {do { code() } while (true); } Expected result: ---------------- Oct 08 09:50:19 php_beautifier [debug] Push Control:333->function Oct 08 09:50:19 php_beautifier [debug] Push Control:317->do Oct 08 09:50:19 php_beautifier [debug] Pop Control:T_DO Oct 08 09:50:19 php_beautifier [debug] Push Control:318->while Oct 08 09:50:19 php_beautifier [debug] Pop Control:T_WHILE Oct 08 09:50:19 php_beautifier [debug] Pop Control:T_FUNCTION Actual result: -------------- Oct 08 09:50:19 php_beautifier [debug] Push Control:333->function Oct 08 09:50:19 php_beautifier [debug] Push Control:317->do Oct 08 09:50:19 php_beautifier [debug] Pop Control:T_DO Oct 08 09:50:19 php_beautifier [debug] Push Control:318->while Oct 08 09:50:19 php_beautifier [debug] Pop Control:T_WHILE ** Missing the pop of T_FUNCTION

Comments

 [2008-10-08 14:58 UTC] fidian (Tyler Akins)
I've noticed that when handling the "while", $this->oBeaut->getControlSeq() returns T_WHILE instead of T_DO, which would make more sense. Both this comment and the bug seem to be a very related issue. Perhaps, while fixing the bug, this enhancement could be made as well?
 [2010-05-26 23:31 UTC] jespino (Jesús Espino)
Fixed in the subversion repository
 [2010-05-29 01:40 UTC] clbustos (Claudio Bustos)
-Status: Open +Status: Closed -Assigned To: +Assigned To: jespino
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.