Edit report at https://bugs.php.net/bug.php?id=61532&edit=1

 ID:                 61532
 Updated by:         johan...@php.net
 Reported by:        iblue at gmx dot net
 Summary:            Apostrophe modifier in *printf is broken
 Status:             Open
 Type:               Bug
 Package:            Strings related
 Operating System:   GNU/Linux
 PHP Version:        5.4.0
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to