|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67423 ngettext() returns po file headers when first param is an empty string
Submitted: 2014-06-11 21:16 UTC Modified: 2014-08-11 21:31 UTC
From: phil at propcom dot co dot uk Assigned:
Status: Not a bug Package: Gettext related
PHP Version: 5.4.29 OS: Centos
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: phil at propcom dot co dot uk
New email:
PHP Version: OS:


 [2014-06-11 21:16 UTC] phil at propcom dot co dot uk
When ngettext is called with an empty string as the first parameter, it returns the unparsed headers from the PO (or indeed MO) file.

Test script:

Expected result:
1 Produkt
<no output>

Actual result:
As per Gist


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-11 21:31 UTC]
-Status: Open +Status: Not a bug
 [2014-08-11 21:31 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Despite being a bit confusing, that's what the gettext library is supposed to be returning when you give an empty string for translation.

If you are curious about the reason, please read the MO format section of gettext from its official website:

"Having the original strings sorted enables the use of simple binary search, for when the MO file does not contain an hashing table, or for when it is not practical to use the hashing table provided in the MO file. This also has another advantage, as the empty string in a PO file GNU gettext is usually translated into some system information attached to that particular MO file, and the empty string necessarily becomes the first in both the original and translated tables, making the system information very easy to find."
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 27 14:03:54 2023 UTC