@@ -99,14 +99,14 @@ private function checkArgumentMismatch($phrase, &$incorrectNumberOfArgumentsErro
99
99
{
100
100
if (preg_match_all ('/%(\w+)/ ' , $ phrase ['phrase ' ], $ matches ) || $ phrase ['arguments ' ]) {
101
101
$ placeholderCount = count (array_unique ($ matches [1 ]));
102
- // count all occurrences of %s
103
- preg_match_all ('/%s / ' , $ phrase ['phrase ' ], $ sprintfMatches );
104
- if (count ($ sprintfMatches [0 ]) > 1 ) {
105
- $ placeholderCount = $ placeholderCount + count ($ sprintfMatches [0 ]) - 1 ;
102
+ // count all occurrences of sprintf placeholders
103
+ preg_match_all ('/%([sducoxXbgGeEfF]) / ' , $ phrase ['phrase ' ], $ sprintfMatches );
104
+ if (count ($ sprintfMatches [0 ]) > count ( array_unique ( $ sprintfMatches [ 0 ])) ) {
105
+ $ placeholderCount = $ placeholderCount + count ($ sprintfMatches [0 ]) - count ( array_unique ( $ sprintfMatches [ 0 ])) ;
106
106
}
107
107
108
- // Check for zend placeholders %placeholder% and sprintf placeholder %s
109
- if (preg_match_all ('/%((s )|([A-Za-z]+)%)/ ' , $ phrase ['phrase ' ], $ placeHolders , PREG_OFFSET_CAPTURE )) {
108
+ // Check for zend placeholders %placeholder% and sprintf placeholders
109
+ if (preg_match_all ('/%(([sducoxXbgGeEfF] )|([A-Za-z]+)%)/ ' , $ phrase ['phrase ' ], $ placeHolders , PREG_OFFSET_CAPTURE )) {
110
110
foreach ($ placeHolders [0 ] as $ ph ) {
111
111
// Check if char after placeholder is not a digit or letter
112
112
$ charAfterPh = $ phrase ['phrase ' ][$ ph [1 ] + strlen ($ ph [0 ])];
0 commit comments