bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xgettext fails to process PHP files if a comment contains <%>


From: Bruno Haible
Subject: Re: xgettext fails to process PHP files if a comment contains <%>
Date: Tue, 19 Nov 2024 18:08:01 +0100

Hi,

David Robinson wrote on 2021-10-16:
> I'm using  <% some_tag %> in PHP comments as a template string to
> later search and replace with version or author information. When
> running xgettext against code with this in a comment, it fails to
> generate a pot file. After some trial and error, the smallest string
> that will cause the failure is <%>
> 
> $ xgettext --version
> xgettext (GNU gettext-tools) 0.19.8.1
> 
> xgettext -LPHP -o test.pot text.php
> 
> This PHP code will not generate a pot file,
> 
> <?php
> //<%>
> _("Text to grab.");
> ?>
> 
> This code will generate a proper pot file.
> 
> <?php
> //<%
> _("Text to grab.");
> ?>
> 
> Is there something significant about <% in gettext or is this a bug?
> Changing the templates to <! !> or <@ @> works fine.

Thanks for the report. <% and %> are PHP 4 syntax, apparently removed in PHP 7
(compare [1] with [2]).

Will be fixed in the next release, through
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=35f408fd83e76f732477eff394c9ef5e1ba31abb

Bruno

[1] 
https://php-legacy-docs.zend.com/manual/php5/en/language.basic-syntax.comments
[2] https://www.php.net/manual/en/language.basic-syntax.comments






reply via email to

[Prev in Thread] Current Thread [Next in Thread]