Edit report at http://pear.php.net/bugs/bug.php?id=14761&edit=1
ID: 14761
Updated by: clbustos@surnet.cl
Reported By: fidian at rumkin dot com
Summary: do {} while () syntax messes up control sequence
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_Beautifier
Operating System: Linux (various)
Package Version: 0.1.14
PHP Version: 5.2.4
-Assigned To:
+Assigned To: jespino
Roadmap Versions:
New Comment:
-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.
Previous Comments:
------------------------------------------------------------------------
[2010-05-26 19:31:15] jespino
Fixed in the subversion repository
------------------------------------------------------------------------
[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
------------------------------------------------------------------------