Bug 14899 - Gettext php parsing library php-mo used for mognase and main website has some issues
Summary: Gettext php parsing library php-mo used for mognase and main website has some...
Status: RESOLVED FIXED
Alias: None
Product: Websites
Classification: Unclassified
Component: Other (show other bugs)
Version: trunk
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Filip Komar
QA Contact:
URL: http://gitweb.mageia.org/web/nav/log/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-27 20:09 CET by Filip Komar
Modified: 2016-07-27 12:58 CEST (History)
1 user (show)

See Also:
Source RPM: http://gitweb.mageia.org/web/nav/log/php-mo.php
CVE:
Status comment:


Attachments
Sample for same msgid with different msgctxt (629 bytes, application/vnd.ms-powerpoint)
2014-12-27 20:12 CET, Filip Komar
Details
Sample for strings w/o white-space (1.23 KB, application/vnd.ms-powerpoint)
2014-12-27 20:13 CET, Filip Komar
Details
Sample for same msgid with different msgctxt (648 bytes, text/x-gettext-translation)
2015-08-26 21:22 CEST, Filip Komar
Details
Sample for strings with no empty line (638 bytes, text/x-gettext-translation)
2015-08-26 21:23 CEST, Filip Komar
Details
Sample with commented fuzzy string (571 bytes, text/x-gettext-translation)
2015-08-26 21:24 CEST, Filip Komar
Details
Sample with one normal and one fuzzy string (553 bytes, text/x-gettext-translation)
2015-08-26 21:25 CEST, Filip Komar
Details
Sample with msgid_plural strings (1.20 KB, text/x-gettext-translation)
2015-08-26 21:25 CEST, Filip Komar
Details
test cases webpage for bugs of php.mo 0.1 by Joss Crowcroft (8.22 KB, application/x-php)
2015-08-26 21:34 CEST, Filip Komar
Details
test cases webpage (7.38 KB, application/x-php)
2016-07-27 12:58 CEST, Filip Komar
Details

Description Filip Komar 2014-12-27 20:09:44 CET
1. Library doesn't handle same msgid with different msgctxt properly. It should distinct them. See https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html for details.

2. It also mishandle succeeding strings without white-space line between.

See bug 10424, comment 10, 11 and 15  for more information.

Reproducible: 

Steps to Reproduce:
Comment 1 Filip Komar 2014-12-27 20:12:16 CET
Created attachment 5763 [details]
Sample for same msgid with different msgctxt

Status: NEW => ASSIGNED
CC: (none) => filip.komar
Assignee: atelier-bugs => filip.komar

Comment 2 Filip Komar 2014-12-27 20:13:15 CET
Created attachment 5764 [details]
Sample for strings w/o white-space
Filip Komar 2014-12-27 20:18:33 CET

URL: (none) => http://gitweb.mageia.org/web/nav/log/php-mo.php

Comment 3 Mageia Robot 2015-08-25 23:11:32 CEST
commit ad791614f4a8f6fc83f9868bc1a9105b6795104d
Author: filip <filip.komar@...>
Date:   Tue Aug 25 23:11:12 2015 +0200

    bugfix for mga#14899 (proper handling of gettext files)
    details in bug report
---
 Commit Link:
   http://gitweb.mageia.org/web/nav/commit/?id=ad791614f4a8f6fc83f9868bc1a9105b6795104d
Comment 4 Mageia Robot 2015-08-25 23:13:56 CEST
commit 5764610c84d44790dff8bebfc503cb6d2b1696f7
Author: filip <filip.komar@...>
Date:   Tue Aug 25 23:13:42 2015 +0200

    bugfix for mga#14899
---
 Commit Link:
   http://gitweb.mageia.org/web/www/commit/?id=5764610c84d44790dff8bebfc503cb6d2b1696f7
Comment 5 Filip Komar 2015-08-26 21:22:18 CEST
Created attachment 6966 [details]
Sample for same msgid with different msgctxt

Attachment 5763 is obsolete: 0 => 1

Comment 6 Filip Komar 2015-08-26 21:23:45 CEST
Created attachment 6967 [details]
Sample for strings with no empty line

Attachment 5764 is obsolete: 0 => 1

Comment 7 Filip Komar 2015-08-26 21:24:41 CEST
Created attachment 6968 [details]
Sample with commented fuzzy string
Comment 8 Filip Komar 2015-08-26 21:25:26 CEST
Created attachment 6969 [details]
Sample with one normal and one fuzzy string
Comment 9 Filip Komar 2015-08-26 21:25:55 CEST
Created attachment 6970 [details]
Sample with msgid_plural strings
Comment 10 Filip Komar 2015-08-26 21:34:57 CEST
Created attachment 6971 [details]
test cases webpage for bugs of php.mo 0.1 by Joss Crowcroft

You need to add php.mo library with the name php-mo_new.php to the same directory as the page and sample files.
Page will show each parsed array and difference from expected result.
Comment 11 Filip Komar 2015-08-26 21:47:06 CEST
Besides two points from Description (same msgid with different msgctxt and strings with no empty line) there was even more bugs:

At least commented fuzzy string bug (See bug 10424) and not the best handling of msgid_plural strings.

See the source of improved code in comment #3 and comment #4 for the structure of the resulting array.

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED

Comment 12 Filip Komar 2016-07-27 12:58:03 CEST
Created attachment 8264 [details]
test cases webpage

updated testing webpage due to changed to a more consistent structure of resulting php array from phpmo library

Attachment 6971 is obsolete: 0 => 1


Note You need to log in before you can comment on or make changes to this bug.