Bug #68274 [Opn->Nab]: vsprintf miscounts argument count
| From: | requinix@php.net | Date: | Tue, 21 Oct 2014 19:25:40 +0000 |
| Subject: | Bug #68274 [Opn->Nab]: vsprintf miscounts argument count | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188235@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68274&edit=1
ID: 68274
Updated by: requinix@php.net
Reported by: eep at mailinator dot com
Summary: vsprintf miscounts argument count
-Status: Open
+Status: Not a bug
Type: Bug
Package: Unknown/Other Function
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2014-10-21 17:11:17] php at mcq8 dot be
As described in the docs (http://be2.php.net/manual/en/function.sprintf.php), you need to use %% to
have the literal percent character.
------------------------------------------------------------------------
[2014-10-21 14:34:32] eep at mailinator dot com
I just realized the provided test script is bad, since second parameter is not optional.
However, even with some parameters, the argument count is still counted wrong.
printf('%s (foo %) bar', 'test');
..produces the same warning.
------------------------------------------------------------------------
[2014-10-21 13:55:43] eep at mailinator dot com
Description:
------------
vsprintf() doesn't validate formatting strings, seems to only count percent signs (followed by
pretty much anything). For example, '%)' expects one parameter.
Test script:
---------------
<?php
vsprintf('(foo %) bar');
Actual result:
--------------
Warning: Wrong parameter count for vsprintf() in /vsprintf.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68274&edit=1