Jump to content

edit invoice error


Blesta Addons

Recommended Posts

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

 

Link to comment
Share on other sites

  • 3 weeks later...

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).

Link to comment
Share on other sites

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 .

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .

 

Link to comment
Share on other sites

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
                    );

 

Link to comment
Share on other sites

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 !!

 

 

Link to comment
Share on other sites

  • 10 months later...

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
                    );
Link to comment
Share on other sites

  • 8 months later...

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 .

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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...