2072/vim-syntax-for-PHP

oddities with shorttag off

gcb opened this issue · 2 comments

gcb commented

Found this by accident, after disabling shorttags parsing after working a rather large file that caused syntax parsing to take a few seconds...

shorttags not disabled (that is, the default)

image
(note that these are not short tags, but echo tags)

with php_noShortTags=1
image

with php_noShortTags=1, if I remove the <?php tag
image

or make the end tag ?> be on a line with code (doesn't have to be a single line with the opening <?php tag. that code block can be any size, only the closing tag matters to not be alone on its own line)
image

short tags are also fine in terms of not messing with the other echo tags
image

but having that php tag anywhere breaks the echo tags parsing
image

note that this doesn't change when editing file. E.g. if I load a file in a working state (i.e. without the bug happening), it won't trigger the bug as i edit file, even if i add <?php and ?> closing on its own line. Only after i save and quit and reopen the file (or save and :e!). Likewise if i open a file with the bug, removing the trigger won't fix it, until I reload the file. Whatever is causing it is "sticky".

gcb commented

it's not just user error as i assumed on the patch above... Some of the above was because of another script (rainbowTags) was marking things with its own PhpRegion_lv0... syntax. With all other removed, a clean vimrc with just the syntax file and

" .vimrc
set nocompatible
syntax on
"let php_noShortTags=1

without the php_noShortTags=1 (i.e. default), all the echo tags are phpRegion. With or without <?php.
image

with php_noShortTags=1, now I get the inverse of the "bug" I was getting when comining with rainbowTags :)

php_noShortTags=1 and with <?php ?> same line i get nothing marked with any synID. all blank. only the stuff inside the php main tag! that is syntaxed as php. the html and echo tags are all unsyntaxed.
image

Same thing for php_noShortTags=1 and No php tag.

With php_noShortTags=1 and a php tag closing on its on line also opposite from before. I get the surrounding of the php tag marked as html, and the echo tags as htmlTag
image

having to save and reload the file is still the same as describe above. That is, after you open the file with or without the bug happening, editing the trigger condition will not change anything, until you reload it.

gcb commented

tried to replace all <?php with <?\(=\|php\) on the matchers for phpRegion but that made all html to be treated as php for some reason.