From: Bruno Haible Date: Tue, 19 Nov 2024 17:03:45 +0000 (+0100) Subject: xgettext: PHP: Stop recognizing ASP tags <% and %> (removed in PHP 7.0). X-Git-Tag: v0.23~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35f408fd83e76f732477eff394c9ef5e1ba31abb;p=thirdparty%2Fgettext.git xgettext: PHP: Stop recognizing ASP tags <% and %> (removed in PHP 7.0). Reported by David Robinson in . * gettext-tools/src/x-php.c (skip_html): Don't recognize '<%' and '<%=' any more. (phase2_getc, phase3_getc, phase4_get): In comments, don't treat '%>' like '?>' any more. --- diff --git a/gettext-tools/src/x-php.c b/gettext-tools/src/x-php.c index 0b8c0f325..19a7cc54c 100644 --- a/gettext-tools/src/x-php.c +++ b/gettext-tools/src/x-php.c @@ -322,18 +322,6 @@ skip_html (struct php_extractor *xp) return; } - if (c2 == '%') - { - /* <% and <%= are recognized by PHP depending on a configuration - setting. */ - int c3 = phase1_getc (xp); - - if (c3 != '=') - phase1_ungetc (xp, c3); - - return; - } - if (c2 == '<') { phase1_ungetc (xp, c2); @@ -549,7 +537,6 @@ phase2_getc (struct php_extractor *xp) switch (c) { case '?': - case '%': { int c2 = phase1_getc (xp); if (c2 == '>') @@ -705,7 +692,7 @@ phase3_getc (struct php_extractor *xp) /* We skip all leading white space, but not EOLs. */ if (!(xp->buflen == 0 && (c == ' ' || c == '\t'))) comment_add (xp, c); - last_was_qmark = (c == '?' || c == '%'); + last_was_qmark = (c == '?'); } xp->last_comment_line = lineno; return '\n'; @@ -792,7 +779,7 @@ phase3_getc (struct php_extractor *xp) /* We skip all leading white space, but not EOLs. */ if (!(xp->buflen == 0 && (c == ' ' || c == '\t'))) comment_add (xp, c); - last_was_qmark = (c == '?' || c == '%'); + last_was_qmark = (c == '?'); } xp->last_comment_line = lineno; return '\n'; @@ -1236,20 +1223,18 @@ phase4_get (struct php_extractor *xp, token_ty *tp) return; case '?': - case '%': { int c2 = phase1_getc (xp); if (c2 == '>') { - /* ?> and %> terminate PHP mode and switch back to HTML - mode. */ + /* ?> terminates PHP mode and switches back to HTML mode. */ skip_html (xp); tp->type = token_type_other; } else { phase1_ungetc (xp, c2); - tp->type = (c == '%' ? token_type_operator1 : token_type_other); + tp->type = token_type_other; } return; }