Unknown format specifier “%c

Description

printf() accepts a string of formats, as the first arguments. A format is a % character, followed by a letter. Some letters are not allowed: a, i, j, k, l, m, n, p, q, r, t, v, w, y, z, A, B, C, D, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, Y, Z

Example

<?php

    printf(\%we3e\\, 123);
    //Unknown format specifier \w\\
?>

Solutions

  • Replace the reported letter with a valid format letter.

  • Duplicate the % sign, to make it literal.