Jump to content

Recommended Posts

Posted

when i want to edit invoice as staff , i get the fallowing error

sprintf(): Too few arguments

full trace error

 

message protected => "sprintf(): Too few arguments"
string private => ""
code protected => 0
file protected => "/home/username/public_html/blesta/vendors/minphp/language/src/Language.php"
line protected => 128
trace private => array (8)
previous private => NULL
severity protected => 2
context => array (6)
lang_key => "AdminClients.editinvoice.page_title"
return => TRUE
language => "en_us"
output => "Client #%1$s Edit Invoice #%2$s"
argc => 3
args => array (2)
0 => "Client #%1$s Edit Invoice #%2$s"
1 => "2"
skippable => TRUE

 

  • 3 weeks later...
Posted

Do you have an $invoice->id_code for that invoice in /app/controllers/admin_clients.php, AdminClients::editInvoice?

The language definition AdminClients.editinvoice.page_title is set there and passed the client ID code and invoice ID code, and only two arguments are expected. You only have 1 argument set, so it looks like you may have bad data set for the invoice (e.g. no id_code).

Posted
On 01/12/2016 at 0:30 AM, Tyson said:

Do you have an $invoice->id_code for that invoice in /app/controllers/admin_clients.php, AdminClients::editInvoice?

The language definition AdminClients.editinvoice.page_title is set there and passed the client ID code and invoice ID code, and only two arguments are expected. You only have 1 argument set, so it looks like you may have bad data set for the invoice (e.g. no id_code).

Normally this is should be care by blesta itself , as the error is shown in the admin client's profile . so if the $invoice->id_code is missing is a blesta bug not mine .

 

Posted

Blesta passes all necessary arguments to language definitions that are required. We weren't able to duplicate this issue with that language definition in the current beta. My only thoughts are that there could have been custom changes made in your installation, where that definition is called, to not pass all of the required language replacement arguments as expected. Either that, or there is something else affecting it, perhaps third-party code.

Posted
3 hours ago, Tyson said:

Blesta passes all necessary arguments to language definitions that are required. We weren't able to duplicate this issue with that language definition in the current beta. My only thoughts are that there could have been custom changes made in your installation, where that definition is called, to not pass all of the required language replacement arguments as expected. Either that, or there is something else affecting it, perhaps third-party code.

i never touch any core files, any way i will upload all the files of beta4  to test it .

 

Posted
14 minutes ago, Blesta Addons said:

is the debugger plugin ....

but i don't know why he is returning a fatal error when debugging is set to true ?

 

Only happens with the debugger plugin? What version of PHP?

Posted

i use php 5.6, and only with the debugger plugin .

after a small look i think the debugger has the right to show a error .

the page title in edit invoice need two argument ($client->id_code, $invoice->id_code) . in the preAction the language set is only for 1 params , the the page title is overrided in line 4064. so i have made a simple correction , from

                    $language = Language::_(
                        'AdminClients.'
                        . Loader::fromCamelCase($this->action ? $this->action : 'index') . '.page_title',
                        true,
                        $client->id_code
                    );

To

                    $language = Language::_(
                        'AdminClients.'
                        . Loader::fromCamelCase($this->action ? $this->action : 'index') . '.page_title',
                        true,
                        $client->id_code,
                        null
                    );

 

Posted

Does it occur when your debugger is disabled? What type of error is it? A Warning, or Exception? It seems odd the error would not be caught and handled properly in php5.6.

Posted

I am able to duplicate this on PHP 7 also, but only when the debugger is enabled. With error reporting enabled without the debugger, I'm not getting any errors at all and the page loads and seems to work just fine.

Posted
23 minutes ago, Paul said:

I am able to duplicate this on PHP 7 also, but only when the debugger is enabled. With error reporting enabled without the debugger, I'm not getting any errors at all and the page loads and seems to work just fine.

Without the debugger no error is shown .

the question why the the debugger (Tracy) catch this error !!

 

 

Posted

Does the debugger have a setting to show warnings? That may be why it shows up. You may want to see if there is a way to disable that.

The point of the code you referenced above is to fallback gracefully on failure so that you don't receive errors like the one you did.

  • 10 months later...
Posted

i still get this error in the monolog files . alot of errors,

E_WARNING: sprintf(): Too few arguments {"code":2,"message":"sprintf(): Too few arguments","file":"/home/fdsfdfdf/public_html/vendors/minphp/language/src/Language.php","line":128}

this error is not from the debugger , but from the blesta logs  warning files .

the page title in edit invoice need two argument ($client->id_code, $invoice->id_code) . in the preAction the language set is only for 1 params , the the page title is overrided in line 4064. so i have made a simple correction , from

                    $language = Language::_(
                        'AdminClients.'
                        . Loader::fromCamelCase($this->action ? $this->action : 'index') . '.page_title',
                        true,
                        $client->id_code
                    );

To

                    $language = Language::_(
                        'AdminClients.'
                        . Loader::fromCamelCase($this->action ? $this->action : 'index') . '.page_title',
                        true,
                        $client->id_code,
                        null
                    );
Posted
8 hours ago, Blesta Addons said:

i still get this error in the monolog files . alot of errors,

I see the entry in the blesta logs but i cant determinate for wich part this related. This is related to edit invoice i will apply your fix and see . We edit invoice manually a lots.

  • 8 months later...
Posted

this error still appear in the logger info when we edit a invoice, is not only related to the debugger or tracy, but also reported by the integrated Monolog logger .

E_WARNING: sprintf(): Too few arguments {"code":2,"message":"sprintf(): Too few arguments","file":"/home/xxxxx/public_html/vendors/minphp/language/src/Language.php","line":125}

is not a trivial or a blocked error, is only a warning, but it should be fixed to eliminate the warning in the logger .

Posted

I think that warning occurs because Blesta attempts to load a certain language definition and then falls back to another if it can't, which is the desired behavior. Unfortunately, php still invokes the warning.

Posted
2 hours ago, Tyson said:

I think that warning occurs because Blesta attempts to load a certain language definition and then falls back to another if it can't, which is the desired behavior. Unfortunately, php still invokes the warning.

that isn't true. the real probleme is the fallowing, the AdminClients controller set the page title in the preAction() function . and is set only one var as params

                    $language = Language::_(
                        'AdminClients.'
                        . Loader::fromCamelCase($this->action ? $this->action : 'index') . '.page_title',
                        true,
                        $client->id_code
                    );

in deed the edit invoice page title require two params

$lang['AdminClients.editinvoice.page_title'] = 'Client #%1$s Edit Invoice #%2$s';

when the controller try to set the page title it show this error, and in the editinvoice() function exist the set page title again, i think from my point of view to fix this either add condition to only set page title in the preaction() function if the action is not editinvoice, or in the set page tittle in preaction() add another null argument to params.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...