Home » PHP » PHP_Beautifier » Bug #7347
[PEAR-filter] control structures indented incorrecly
Details
| Submitted | 2006-04-09 09:06 UTC |
|---|---|
| From | soporte at onfocus dot cl |
| Assigned | clbustos |
| Status | Closed |
| Package | PHP_Beautifier |
| PHP Version | Irrelevant |
| OS | * |
| Roadmaps | (Not assigned) |
Comments
[2006-04-09 09:06 UTC] soporte at onfocus dot cl
Description:
------------
according to: http://pear.php.net/manual/en/standards.control.php
control strutures should be indented in K&R style
if (<cond>) {
<body>
}
however, are getting indented in Allman style
all control structures are affected.
Saludos ;)
Test script:
---------------
run pear filter
Expected result:
----------------
if (<cond>) {
<body>
}
Actual result:
--------------
if (<cond>)
{
<body>
}
[2006-06-06 03:56 UTC] clbustos at php dot net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PEAR better.
I can't replicate the error.
Please, use
$oBeaut = new PHP_Beautifier();
$oBeaut->startLog();
$oBeaut->addFilter('Pear');
$oBeaut->setInputFile('examples/example_pear.php');
$oBeaut->process();
$oBeaut->show();
and send me the file php_beautifier.log to see what happens.
[2006-06-10 02:13 UTC] soporte at onfocus dot cl
Claudio:
The results of your test are here :
http://www.onfocus.cl/judas/phpbeautifier-bugs/
result_test.txt --> the output of your test
php_beautifier.log --> log file
trace.2043925204.xt.bz2 --> pretty big xdebug trace to look in a detailed way what's going on behind the scenes ;-)
pear filter doesn't seems to do the job :-(, Im using PHP 5_2 CVS on amd64 but I have reproduced it with previuos versions too.
Im busy ATM to give it a look by myself :-(
Hope that helps.
[2006-06-10 04:22 UTC] soporte at onfocus dot cl
oddly enough, your test actually works mostly Ok (contrariely to what I stated before), but Im getting different results on a real life system using the command line tool....
I may analize this situation lately.
[2006-06-10 06:32 UTC] soporte at onfocus dot cl
I isolated the problem , it fails only with control structures inside class methods.
this fails to indent the "if" in K&R style using the same code you provided in comment #2.
<?php
class Foo {
public function __construct() {
if($foo && $bar)
{
echo "FUBAR¡¡";
}
}
}
?>
[2006-06-13 21:25 UTC] clbustos at php dot net
This bug has been fixed in CVS.
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.
Use svn co https://svn.sourceforge.net/svnroot/beautifyphp beautifyphp/trunk PHP_Beautifier