php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35767 *printf argument swapping doesn't work with constants
Submitted: 2005-12-21 21:38 UTC Modified: 2005-12-21 21:40 UTC
From: capiCrimm at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5CVS-2005-12-21 (snap) OS: WinXP/GNU Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
9 + 17 = ?
Subscribe to this entry?

 
 [2005-12-21 21:38 UTC] capiCrimm at gmail dot com
Description:
------------
Using argument swapping with *printf you get a parse error thats the same as if you included a variable in the string. 

Reproduce code:
---------------
class Slaughter
{
  const pig = "%1/$s is dead!";
  
  public function __construct(){
    printf(self::pig,'Oinker ');
  }
}
new Slaughter;

Expected result:
----------------
Oinker is dead!

Actual result:
--------------
Parse error: parse error, unexpected '"' in <> on line <>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-21 21:40 UTC] capiCrimm at gmail dot com
I hate being stupid, the I was using forward slashes... :\
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC