TT#12251 Fix unescaped left brace in regex of InvoiceTemplate.pm

ngcp-panel fails to start up on Debian/stretch based systems:

| ngcp-panel[1471]: Starting NGCP-Panel Webapp:Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(?:{\s*)?<!--{ <-- HERE |}-->(?:\s*})?/ at /usr/share/perl5/NGCP/Panel/Utils/InvoiceTemplate.pm line 105, <DATA> line 1.
| ngcp-panel[1471]: Compilation failed in require at /usr/share/perl5/NGCP/Panel/Controller/Pbx.pm line 9, <DATA> line 1.
| ngcp-panel[1471]: BEGIN failed--compilation aborted at /usr/share/perl5/NGCP/Panel/Controller/Pbx.pm line 9, <DATA> line 1.
| ngcp-panel[1471]: Compilation failed in require at /usr/share/perl5/Catalyst/Utils.pm line 309, <DATA> line 1.
| ngcp-panel[1471]: Compilation failed in require at /usr/share/perl5/Module/Runtime.pm line 317, <DATA> line 1. at /usr/share/ngcp-panel/ngcp_panel_fastcgi.pl line 4.
| ngcp-panel[1471]: error ... failed!
| ngcp-panel[1471]:  failed!

Minimal example:

% perl -E 'm/foo{x}bar/'
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/foo{ <-- HERE x}bar/ at -e line 1.
% perl -E 'm/foo\{x\}bar/'
%

This is new behavior as of Perl 5.22 (and we've Perl v5.24.1 on
Debian/stretch), quoting
http://search.cpan.org/dist/perl-5.22.0/pod/perldelta.pod#New_Warnings:

| Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%s/
|
|    (D deprecated, regexp) You used a literal "{" character in a regular expression pattern.
|    You should change to use "\{" instead, because a future version of Perl (tentatively v5.26)
|    will consider this to be a syntax error. If the pattern delimiters are also braces, any
|    matching right brace ("}") should also be escaped to avoid confusing the parser, for example,
|
|        qr{abc\{def\}ghi}

Change-Id: I6192b723bb7a0f95b64b6b01ba75988021dc22a6
changes/21/11721/1
Michael Prokop 9 years ago
parent cd030f745a
commit b38d11465d

@ -102,7 +102,7 @@ sub preprocess_svg_pdf {
sub preprocess_svg {
my($svg_ref) = @_;
$$svg_ref=~s/(?:{\s*)?<!--{|}-->(?:\s*})?//gs;
$$svg_ref=~s/(?:{\s*)?<!--\{|\}-->(?:\s*})?//gs;
$$svg_ref = '<root>'.$$svg_ref.'</root>';
my $xp = XML::XPath->new($$svg_ref);

Loading…
Cancel
Save