Title: PHP Warning: sprintf(): Too few arguments
Last modified: March 7, 2021

---

# PHP Warning: sprintf(): Too few arguments

 *  Resolved [janrenn](https://wordpress.org/support/users/janrenn/)
 * (@janrenn)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/)
 * Hello Collins, thanks for the plugin!
 * After 2.2.12 update i am getting `PHP Warning: sprintf(): Too few arguments in(...)\
   plugins\wp-user-avatar\includes\class-wp-user-avatar-functions.php on line 478`
 * Thats due to lack of `sprintf` escaping of `%` [https://stackoverflow.com/questions/3666734/php-sprintf-escaping](https://stackoverflow.com/questions/3666734/php-sprintf-escaping)
   because `img src=` may contain `%`s in URL-escaped URL…
 * On top of that, `esc_attr( implode( ' ', $class ) )` as a second parameter appends
   possible `$class`es without space before.
 * My hotfixed file: [https://gist.github.com/renner108/c63432a257c1d0f1f894b03b668e4974](https://gist.github.com/renner108/c63432a257c1d0f1f894b03b668e4974)
 * Thanks again, Jan
    -  This topic was modified 5 years, 3 months ago by [janrenn](https://wordpress.org/support/users/janrenn/).

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [osmanham](https://wordpress.org/support/users/osmanhameed/)
 * (@osmanhameed)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14147988)
 * Dealing with this same issue. Getting this error on our website after updating
   to 2.2.12:
 * `Warning: sprintf(): Too few arguments in (...)/wp-content/plugins/wp-user-avatar/
   includes/class-wp-user-avatar-functions.php on line 668`
 * Will be awesome to get a fix pushed out for us less tech-savvy folk 😉
    -  This reply was modified 5 years, 3 months ago by [osmanham](https://wordpress.org/support/users/osmanhameed/).
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14148113)
 * The formatting string should contains `%s` for each string. If developers want
   to use [sprintf](https://www.php.net/manual/en/function.sprintf.php), correct
   solution is:
 *     ```
              $avatar = sprintf(
                  '<img src="%s"%s alt="%s" class="avatar avatar-%s wp-user-avatar wp-user-avatar-%s photo avatar-default %s" />',
                  $wpua_final_avatar_image_src,
                  $default_image_details['dimensions'],
                  $alt,
                  $size,
                  $size,
                  esc_attr( implode( ' ', $class ) )
              );
       ```
   
 *  Thread Starter [janrenn](https://wordpress.org/support/users/janrenn/)
 * (@janrenn)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14148294)
 * [@stodorovic](https://wordpress.org/support/users/stodorovic/) +1 for this solution
 *  [blastofshadows](https://wordpress.org/support/users/blastofshadows/)
 * (@blastofshadows)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14151843)
 * Nos hemos encontrado con el mismo problema al actualizar, la única solución que
   encontramos es desactivar el complemento :S 🙁
 *  Moderator [Yui](https://wordpress.org/support/users/fierevere/)
 * (@fierevere)
 * 永子
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14153576)
 * Please, if you have “same issue”, consider opening your own support topics,
    
   or if you are sure it is absolutely same (not all same issues are same, because
   of many varieties of server and wordpress environments), then just subscribe 
   for this topic on the sidebar. “Metoo” like replies wont help finding the solution.
 *  [producerspot](https://wordpress.org/support/users/producerspot/)
 * (@producerspot)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14153982)
 * from where I can get the previous working version?
 *  [Saša](https://wordpress.org/support/users/stodorovic/)
 * (@stodorovic)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14154239)
 * It’s possible to download previous versions from wordpress.org (eg. [https://downloads.wordpress.org/plugin/wp-user-avatar.2.2.11.zip](https://downloads.wordpress.org/plugin/wp-user-avatar.2.2.11.zip)).
 * There are 3 places where is used [sprintf](https://www.php.net/manual/en/function.sprintf.php)
   function. I hope that an update will be released soon because we already proposed
   correct solutions (_use proper placeholder `%s` for each string variable_).
 *  Plugin Author [Collins Agbonghama](https://wordpress.org/support/users/collizo4sky/)
 * (@collizo4sky)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14174273)
 * Everyone please update to 2.2.14.
 * Let me know if that fixes the issue.
 *  [TeamEmilie](https://wordpress.org/support/users/teamemilie/)
 * (@teamemilie)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14174844)
 * I upgraded to: Version 2.2.14
    Still have the issue, but only when i’m logged
   in :
 * Warning: sprintf(): Too few arguments in /customers/6/4/d/(…)/httpd.www/wp-content/
   plugins/wp-user-avatar/includes/class-wp-user-avatar-functions.php on line 666
 *  Plugin Author [Collins Agbonghama](https://wordpress.org/support/users/collizo4sky/)
 * (@collizo4sky)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14175289)
 * [@teamemilie](https://wordpress.org/support/users/teamemilie/) 2.2.15 should 
   fix your issue.
 * Let me know if that works.
 *  [TeamEmilie](https://wordpress.org/support/users/teamemilie/)
 * (@teamemilie)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14175954)
 * [@collizo4sky](https://wordpress.org/support/users/collizo4sky/)
    You are right.
   Thanks and thank you very much for quick fix! Have a pleasent day. Bast Regards
 *  Thread Starter [janrenn](https://wordpress.org/support/users/janrenn/)
 * (@janrenn)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14179203)
 * [@collizo4sky](https://wordpress.org/support/users/collizo4sky/) fixed. Thanks
   a lot. JR

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘PHP Warning: sprintf(): Too few arguments’ is closed to new replies.

 * ![](https://ps.w.org/wp-user-avatar/assets/icon-256x256.png?rev=2532486)
 * [Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress](https://wordpress.org/plugins/wp-user-avatar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-user-avatar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-user-avatar/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-user-avatar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-user-avatar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-user-avatar/reviews/)

 * 12 replies
 * 11 participants
 * Last reply from: [janrenn](https://wordpress.org/support/users/janrenn/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/php-warning-sprintf-too-few-arguments/#post-14179203)
 * Status: resolved