From: Bruno Haible Date: Sun, 22 Jun 2025 00:38:50 +0000 (+0200) Subject: php-format: Reject null precision. X-Git-Tag: v0.26~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0a5ed01807c21d3fcb01df7a565fa06ac88fb90;p=thirdparty%2Fgettext.git php-format: Reject null precision. Rationale: The handling of null precision in php is buggy, cf. . * gettext-tools/src/format-php.c: Fix comment regarding the precision. * gettext-tools/tests/format-php-1: Add a test case with null precision. --- diff --git a/gettext-tools/src/format-php.c b/gettext-tools/src/format-php.c index 11b55a0d7..c1ec3abbb 100644 --- a/gettext-tools/src/format-php.c +++ b/gettext-tools/src/format-php.c @@ -40,8 +40,10 @@ "'", each of which acts as a flag, - is optionally followed by a width specification: a nonempty digit sequence, - - is optionally followed by '.' and a precision specification: a nonempty - digit sequence, + - is optionally followed by '.' and a precision specification: an [optional?] + nonempty digit sequence, + (It's optional per , + but this is actually buggy: .) - is optionally followed by a size specifier 'l', which is ignored, - is finished by a specifier - 's', that needs a string argument, diff --git a/gettext-tools/tests/format-php-1 b/gettext-tools/tests/format-php-1 index a7420375d..844be7ce4 100755 --- a/gettext-tools/tests/format-php-1 +++ b/gettext-tools/tests/format-php-1 @@ -54,6 +54,8 @@ cat <<\EOF > f-ph-1.data "abc%y" # Invalid: flags after width "abc%5-f" +# Invalid: null precision +"abc%.f" # Invalid: twice precision "abc%.4.2f" # Valid: three arguments