bugGNU gettext - Bugs: bug #41406, xgettext fails to parse PHP files...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #41406: xgettext fails to parse PHP files that contain nowdocs (patch available)

Submitted by:  None
Submitted on:  Thu 30 Jan 2014 06:02:22 PM UTC  
 
Category: PHPSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Daiki Ueno <ueno>
Open/Closed: Closed

Mon 10 Mar 2014 12:47:44 PM UTC, comment #2:

Pushed now: http://git.savannah.gnu.org/cgit/gettext.git/commit/?h=maint&id=4c47fc6b0fcb0d1199e8834ccef41a93b8c1d243

Daiki Ueno <ueno>
Project AdministratorIn charge of this item.
Fri 31 Jan 2014 03:12:27 AM UTC, comment #1:

Thanks for reminding. Looking at the manual, it seems that optional double quotes enclosing heredoc identifier was also added at the same time (PHP 5.3). I'll merge the patch after adding support for it.

Daiki Ueno <ueno>
Project AdministratorIn charge of this item.
Thu 30 Jan 2014 06:02:22 PM UTC, original submission:

xgettext's PHP parser correctly handles heredoc syntax:

$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;

But if it encounters the similar newdoc block, it fails:

$str = <<<'EOD'
Example of string
spanning multiple lines
using nowdoc syntax.
EOD;

(Reference: http://www.php.net/manual/en/language.types.string.php)

This isn't about being able to extract translatable strings written as newdoc, that's fine as far as I am concerned. But if a PHP file contains a newdoc block, xgettext will not see anything below it, including ordinary _("strings like this").

Andreas Stricker posted a patch for this to bug-gettext in April 2012, but it seems it felt through the cracks:

http://lists.gnu.org/archive/html/bug-gettext/2012-04/msg00002.html

Would it be possible to apply it?

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Updated the item)
  • -unavailable- added by ueno (Posted a comment)
  • -unavailable- added by vslavik
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Nov 2016 11:43:14 AM UTChaibleCategoryNone=>PHP
    Mon 10 Mar 2014 12:47:44 PM UTCuenoStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 31 Jan 2014 03:12:27 AM UTCuenoAssigned toNone=>ueno
    Thu 30 Jan 2014 06:05:50 PM UTCvslavikCarbon-Copy-=>Added vslavik

    Back to the top


    Powered by Savane 3.1-cleanup1