From: Peter Graves <peter@ar...> - 2002-09-22 18:58:27
Bug 612768, reported by David Smith:
As of 0.16.4, I'm seeing the following indentation
schemes in PHP:
foreach($x as $y)
for($x=0; $x<100; $x++ )
if( $bool == true )
if( $something )
To reproduce the bug, enter the foreach() statement and
press enter. Notice that the indentation of the
subsequent line is much too far. The same is truf of
other constructs but not the case for elseif.
This bug is fixed in this morning's development snapshot:
http://armedbear.org/j-jar.zip (just j.jar)
Indentation in PHP mode was subject to a NullPointerException in
certain embarrassingly common indentation contexts if you didn't open
a file in Java mode first. Really.
PHPMode is a subclass of JavaMode, and the JavaMode indentation code
is used for PHP mode too. Unfortunately there were a couple of places
in the shared indentation code that referred to a static field in the
JavaMode class that was not initialized until you opened a file in
If you hit one of these code paths, a NullPointerException would
occur. J would recover from the NPE, but the indentation of the line
in question would not be performed correctly. Once that line was out
of line, later lines might also be misaligned, even if not themselves
subject to the aforementioned NPE.
I never saw this bug until now because I've always had some Java files
open when I was testing PHP mode.
In any case, this bug is now fixed.
In addition, there was a bit of PHP-specific indentation code that
knew about "elseif", but not "foreach"; that deficiency has also been
J now indents David's code sample correctly, once you replace the bare
"elseif" with something like "elseif (a == b)".
Sorry for the inconvenience.