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.

Bug 240795 - Backslashes cannot be placed before ending single quotes
Summary: Backslashes cannot be placed before ending single quotes
Status: RESOLVED DUPLICATE of bug 248316
Alias: None
Product: php
Classification: Unclassified
Component: Twig (show other bugs)
Version: 7.4
Hardware: All All
: P4 normal (vote)
Assignee: junichi11
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-21 20:44 UTC by enzo4
Modified: 2017-05-24 12:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (5.30 KB, image/png)
2017-05-24 12:12 UTC, junichi11
Details

Note You need to log in before you can comment on or make changes to this bug.
Description enzo4 2014-01-21 20:44:39 UTC
The following twig line breaks a twig file

{% set f = '..'|split('\\') %}

The current workaround is to add a space and trim it:

{% set f = '..'|split('\\ '|trim) %}
Comment 1 Ondrej Brejla 2014-01-22 13:40:05 UTC
Hmm...seems to be a bug in JFlex, because string without a trailing quote is matched by a reg exp which requires ending quote :/ So the fix will not be as simple as it looks like, lexing of strings has to be rewritten somehow.
Comment 2 Ondrej Brejla 2014-01-22 13:58:42 UTC
Fixed in web-main #1eb74ea9f88a
Comment 3 Ondrej Brejla 2014-01-22 14:38:35 UTC
Sorry, I had to revert it because it broke up escaping inside strings (which is used much more, this case happens only when backslash is right before closing quote). Thats definitely bug in JFlex, simple common regexs for matching simple strings doesn't work at all (it fails in case when \ is before closing delimiter).
Comment 4 Quality Engineering 2014-01-23 02:39:25 UTC
Integrated into 'main-silver', will be available in build *201401230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1eb74ea9f88a
User: Ondrej Brejla <obrejla@netbeans.org>
Log: #240795 - Twig doesn't escape well the \
Comment 5 enzo4 2014-01-23 08:04:15 UTC
@Ondrej
A new version of JFlex has been released 2 days ago!, maybe it gives a chance to fix this issue. Have you tried it ?

If not, would you mind posting a bug in JFlex ?
Indded, as for a previous bug (an external tool was involved), it has much efficienty if bug is reported by a netbeans developer I guess ;)

Big thanks for your work btw, NB is so nice for php/symfony/twig dev!
Comment 6 Ondrej Brejla 2014-01-23 09:02:47 UTC
Yes I tried that yesterday...still same problem. I'll have to prepare some simple sample which reproduces that issue. Thanks!
Comment 7 colan 2016-07-27 19:48:03 UTC
Updated metadata as this affects generic PHP, not just Twig.
Comment 8 junichi11 2017-05-24 12:11:09 UTC
AFAR, probably, this issue was fixed in the issue 248316. So please try to use a dev version[1].

[1] http://bits.netbeans.org/download/trunk/nightly/latest/

Thanks.

*** This bug has been marked as a duplicate of bug 248316 ***
Comment 9 junichi11 2017-05-24 12:12:47 UTC
Created attachment 164395 [details]
screenshot