|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26878 *printf argument swapping
Submitted: 2004-01-12 07:42 UTC Modified: 2004-01-13 18:26 UTC
From: drm at melp dot nl Assigned:
Status: Closed Package: Strings related
PHP Version: 4CVS, 5CVS 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: drm at melp dot nl
New email:
PHP Version: OS:


 [2004-01-12 07:42 UTC] drm at melp dot nl
The *printf family has a bug when pointing to the same argument with different types. Probably the same memoryaddress is used for casting when formatting the argument.

Reproduce code:
printf ( 
   'Int: %1$d and as string: %1$s', 
   'some string' 

// Note that the same happens when 
// using any of the other printf
// functions

Expected result:
Int: 0 and as string: some string

Actual result:
Int: 0 and as string: 0


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-13 18:26 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 02:01:30 2024 UTC