Doc #61626 [Opn->Csd]: %c format code ignores width specification
| From: | krakjoe@php.net | Date: | Wed, 09 Oct 2013 06:16:06 +0000 |
| Subject: | Doc #61626 [Opn->Csd]: %c format code ignores width specification | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10448@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61626&edit=1
ID: 61626
Updated by: krakjoe@php.net
Reported by: donretzlaff at gmail dot com
Summary: %c format code ignores width specification
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Ubuntu
PHP Version: 5.3.10
-Assigned To:
+Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2013-10-09 06:16:00] krakjoe@php.net
Automatic comment from SVN on behalf of krakjoe
Revision: http://svn.php.net/viewvc/?view=revision&revision=331738
Log: #61626 include warning about %c ignoring width/padding
------------------------------------------------------------------------
[2012-04-04 18:20:00] donretzlaff at gmail dot com
Description:
------------
Nothing unique about my configuration; I've tried this on several different
machines with different PHP versions and received the same result.
When I attempt to use the %c formatting code with (for example, sprintf()),
it ignores any width specifier that I indicate, as in the example code below.
I saw nothing in the documentation that the %c code would not react to a width
specifier any differently than the other data formats.
Test script:
---------------
<pre>
<?php
$x = ord('A');
echo sprintf("|%c|\n",$x);
echo sprintf("|%1c|\n",$x);
echo sprintf("|%2c|\n",$x);
echo sprintf("|%3c|\n",$x);
echo sprintf("|%4c|\n",$x);
echo sprintf("|%5c|\n",$x);
echo sprintf("|%6c|\n",$x);
echo sprintf("|%7c|\n",$x);
echo sprintf("|%-8c|\n\n\n",$x);
?>
Expected result:
----------------
|A|
|A|
| A|
| A|
| A|
| A|
| A|
| A|
|A |
(I expected this because this is what the equivalent code in C produces)
Actual result:
--------------
|A|
|A|
|A|
|A|
|A|
|A|
|A|
|A|
|A|
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61626&edit=1