Bug #68274 [Com]: vsprintf miscounts argument count

From: Date: Tue, 21 Oct 2014 17:11:18 +0000
Subject: Bug #68274 [Com]: vsprintf miscounts argument count
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188232@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 Comment by: php at mcq8 dot be Reported by: eep at mailinator dot com Summary: vsprintf miscounts argument count Status: Open Type: Bug Package: Unknown/Other Function PHP Version: Irrelevant Block user comment: N Private report: N New Comment: As described in the docs (http://be2.php.net/manual/en/function.sprintf.php), you need to use %% to have the literal percent character. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#188232) next »