|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34116 support for variable length printf strings
Submitted: 2005-08-13 11:35 UTC Modified: 2020-06-19 10:23 UTC
Avg. Score:3.8 ± 1.3
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ondrej at sury dot org Assigned: nikic (profile)
Status: Closed Package: Strings related
PHP Version: 4CVS-2005-08-13 (stable) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ondrej at sury dot org
New email:
PHP Version: OS:


 [2005-08-13 11:35 UTC] ondrej at sury dot org
PHP's printf does not support variable width/precision.

Compare that with "printf '%*s' 10 'foobar'" in a shell script.

Reproduce code:

$length = 10;

printf("%*s", $length, "foobar");

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 22:59 UTC]
-Package: Feature/Change Request +Package: Strings related
 [2020-04-21 16:34 UTC]
-Assigned To: +Assigned To: nikic
 [2020-06-19 10:23 UTC]
-Status: Assigned +Status: Closed
 [2020-06-19 10:23 UTC]
This is supported as of PHP 8.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 23:01:30 2024 UTC