Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging error with '%' : Warning fprintf too few arguments #113

Open
sherbrow opened this issue Sep 1, 2019 · 1 comment
Open

Logging error with '%' : Warning fprintf too few arguments #113

sherbrow opened this issue Sep 1, 2019 · 1 comment

Comments

@sherbrow
Copy link
Contributor

sherbrow commented Sep 1, 2019

Hello,

We get from time to time the warning

Warning: fprintf(): Too few arguments in /path/to/project/vendor/corneltek/cliframework/src/Logger.php on line 183

Because the message getting logged contains %, in our case, an URL encoded provided by the service we're calling.

A quick fix is to escape % :

fprintf(STDERR, str_replace('%', '%%', $this->formatter->format($msg , $style)) . PHP_EOL);

fprintf(STDERR, $this->formatter->format($msg, $style) . PHP_EOL);

I'm not sure where to point a fix, if the formatter should be involved or not, although I'm convinced the fprintf without additional arguments should escape %.

Thank you for your help.

@c9s
Copy link
Owner

c9s commented Sep 2, 2019

I think the fix is ok. Please send a pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants