php-gettext / Gettext

PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
MIT License
687 stars 132 forks source link

Fixed integer bug in filename type from references #260

Closed Darkmet98 closed 4 years ago

Darkmet98 commented 4 years ago

Hello. I found a bug with GetText. When it updates a translation, if References is a numeric value, the program crashes.

A solution would be checking first if it is a numeric value, else it converts the number into a text string.

ERROR: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Gettext\References::add() must be of the type string, int given, called in C:\Users\iinfe\PhpstormProjects\TranslationWorks\vendor\gettext\gettext\src\References.php on line 72 and defined in C:\Users\iinfe\PhpstormProjects\TranslationWorks\vendor\gettext\gettext\src\References.php:31

ENTRY EXAMPLE:

#. Igor
#: 1
msgctxt "E101_001.PTP:1:3"
msgid ""
"It may be that such a fate awaits you\n"
"in the near future."
msgstr ""
"Puede que tal destino te aguarde en\n"
"un futuro próximo."
Darkmet98 commented 4 years ago

Ok, I guess this happens when the filename is 1 (without extension), right?

yes

oscarotero commented 4 years ago

Thanks!