Bug #14761 [Com]: do {} while () syntax messes up control sequence

From: Date: Wed, 26 May 2010 19:31:15 +0000
Subject: Bug #14761 [Com]: do {} while () syntax messes up control sequence
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-3803@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=14761&edit=1 ID: 14761 Comment by: jespinog@gmail.com Reported By: fidian at rumkin dot com Summary: do {} while () syntax messes up control sequence Status: Open Type: Bug Package: PHP_Beautifier Operating System: Linux (various) Package Version: 0.1.14 PHP Version: 5.2.4 Roadmap Versions: New Comment: Fixed in the subversion repository Previous Comments: ------------------------------------------------------------------------ [2008-10-08 10:58:06] fidian 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? ------------------------------------------------------------------------ [2008-10-08 10:53:57] fidian 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 ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=14761&edit=1

« previous php.pear.bugs (#3803) next »