Bug 14899

Summary: Gettext php parsing library php-mo used for mognase and main website has some issues
Product: Websites Reporter: Filip Komar <filip.komar>
Component: OtherAssignee: Filip Komar <filip.komar>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal CC: filip.komar
Version: trunk   
Target Milestone: ---   
Hardware: i586   
OS: Linux   
URL: http://gitweb.mageia.org/web/nav/log/php-mo.php
Whiteboard:
Source RPM: http://gitweb.mageia.org/web/nav/log/php-mo.php CVE:
Status comment:
Attachments: Sample for same msgid with different msgctxt
Sample for strings w/o white-space
Sample for same msgid with different msgctxt
Sample for strings with no empty line
Sample with commented fuzzy string
Sample with one normal and one fuzzy string
Sample with msgid_plural strings
test cases webpage for bugs of php.mo 0.1 by Joss Crowcroft
test cases webpage

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