Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

OsTicket PHP Warning: sprintf(): Too few arguments

I have a problem with OsTicket 1.9 in Ubuntu 14 with PHP 5.5.9 the theme is as follows and install it even configure it with users and emails but the problem is that when I send an email to the mail that assign to create the Ticket if I return the confirmation email that the ticket was created but does not save any record in the database and obviously does not show anything in the graphical interface and looking at the log of the server itself returns the following error.

PHP Warning: sprintf (): Pocos argumentos en /var/www/tools/servicios/include/staff/profile.inc.php en la línea 156, árbitro: http://web.com/servicios/scp/staff.php

the code

150-<?php
151-   $y=1;
152-   for($i=1; $i <=30; $i+=$y) {
153-     $sel=($info['auto_refresh_rate']==$i)?'selected="selected"':'';
154-     echo sprintf('<option value="%1$d" %2$s>'
155-     .sprintf(
156-         _N('Every minute', 'Every %d minutes', $i), $i)
157-         .'</option>',$i,$sel);
158-     if($i>9)
159-     $y=2;
160-} ?>

Comments

  • Please help us to help you by reading and following the posting guidelines located in this thread: Please read before requesting assistance.  The more information you give us the better we will be able to assist you. Thank you.

    Version of osTicket?
    Version of PHP?
  • edited June 15
    OsTicket 1.9.15 in Ubuntu 14 with PHP 5.5.9 Thanks for the help

  • I already followed his recommendations before asking for assistance and remove the translation I had in Spanish and now even if he wants to send me any error I have already activated the error flags and still nothing does not send an error nor does it work
  • Not entirely sure what the issue is, but had a look at that snippet.

    Reformatted it a bit to make it clearer what I think it does, and it works:
    $info['auto_refresh_rate'] = 5; //for test

    for($i = 1, $y = 1; $i <= 30; $i += $y) {
    $sel = ($info ['auto_refresh_rate'] == $i) ? ' selected="selected"' : '';
    $text = _N ( 'Every minute', sprintf ( 'Every %d minutes', $i ), $i );
    echo sprintf ( '<option value="%d"%s>%s</option>', $i, $sel, $text );
    if ($i > 9)
    $y = 2;
    }

    Produces:
    ...snipped...<option value="4">Every 4 minutes</option><option value="5" selected="selected">Every 5 minutes</option><option value="6">Every 6 minutes</option><option value="7">Every 7 minutes</option><option value="8">Every 8 minutes</option><option value="9">Every 9 minutes</option><option value="10">Every 10 minutes</option><option value="12">... snipped ...


    Checked mine, and it hasn't changed much for 1.10, maybe we need to submit a patch. I think the _N inside the sprintf is invalid. It should to be the other way around.
Sign In or Register to comment.