Doc #61532 [Opn->Nab]: Apostrophe modifier in *printf is broken

From: Date: Wed, 14 Jan 2015 14:56:34 +0000
Subject: Doc #61532 [Opn->Nab]: Apostrophe modifier in *printf is broken
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11854@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61532&edit=1 ID: 61532 Updated by: danack@php.net Reported by: iblue at gmx dot net Summary: Apostrophe modifier in *printf is broken -Status: Open +Status: Not a bug Type: Documentation Problem Package: Strings related Operating System: GNU/Linux PHP Version: 5.4.0 Block user comment: N Private report: N New Comment: It has been documented that 0 as padding specifier overwrites a manually set one. Previous Comments: ------------------------------------------------------------------------ [2015-01-14 14:55:30] danack@php.net Automatic comment from SVN on behalf of danack Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=335742 Log: Added detail about padding character for bug 61532 ------------------------------------------------------------------------ [2012-04-12 10:13:52] johannes@php.net It should be documented that 0 as padding specifier overwrites a manually set one. ------------------------------------------------------------------------ [2012-04-12 10:09:19] johannes@php.net The current behaviour seems to be in line with what libc does, both on Linux and Solaris (and gcc and suncc): $ cat test.c #include <stdio.h> void main() { printf("%'.09i\n", 123); } $ gcc -otest test.c $ ./test 000000123 ------------------------------------------------------------------------ [2012-03-27 21:28:09] iblue at gmx dot net Description: ------------ When I use the apostrophe (') modifier to select a padding character in printf, it behaves buggy, when the padding length itself is prefixed by zeroes. Test script: --------------- <?php echo sprintf("%'.9s\n", "foo"); echo sprintf("%'.09s\n", "foo"); Expected result: ---------------- ......foo ......foo Actual result: -------------- ......foo 000000foo ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61532&edit=1

« previous php.doc.bugs (#11854) next »