Skip to content

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

@sherbrow

Description

@sherbrow

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions