This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
NetBeans reports a syntax error (unterminated string literal) for the following (valid) JavaScript/PHP construct. <script type="text/javascript"> var sessionId ="<?php echo $sid; ?> "; </script> For static parsing the code seems invalid. But if you run the code, you will find that the EOL characters after ?> are ignored. So the output of the script above is the following valid code: <script type="text/javascript"> var sessionId ="1234"; </script> While I personally won't wright code like this, the output is actually produced by the Smarty Template Engine, which always adds a line-break after each delimiter. As a result NetBeans reports many errors within files inside Smarty's template cache directory. Workaround: - create a custom filter to tell NetBeans to ignore Smarty's compile cache
The problem here is not the templating language, but the endline after the <? section ?> and the closing quote. It these are at the same line, the editor doesn't complain. <script type="text/javascript"> var sessionId ="<?php echo $sid; ?>"; </script> is lexed and parsed w/o problems.
Yes, you are right. That's what I said. The parser should be aware that any new-line after a closing ?> must be ignored. So this code: var sessionId ="<?php echo $sid; ?> "; And this code: var sessionId ="<?php echo $sid; ?>"; Are perfectly the same and should be treated equally. Reason (long story): This (strange) rule has something to do with unix-style files, that always end with a single new-line character, thus conflicting with the requirement to close the PHP-tag. Ergo: the developers set up a rule, that any new-line directly following a closing PHP-tag will be removed by PHP automatically and thus must be ignored. Some libraries and editors make extensive use of this rule (e.g. the popular Smarty template engine). Thus resulting in hundreds of irrelevant (and obviously wrong) error messages cluttering up NetBeans' task-list. If this is the first thing you recognize as a developer when opening your project in NetBeans for the first time, it could be a real show-stopper.
Reproducible in NB 7.1
Fixed in web-main 5f47746be723.
Integrated into 'main-golden', will be available in build *201209140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/5f47746be723 User: Petr Hejl <phejl@netbeans.org> Log: #167856 - Mixed JS/PHP highlighting bug