Blesta Addons Posted November 13, 2016 Report Posted November 13, 2016 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 Quote
Tyson Posted December 1, 2016 Report Posted December 1, 2016 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). Quote
activa Posted December 7, 2016 Report Posted December 7, 2016 I get error when i want to edit invoice in v4 beta3 from admin area .... In client profile , i click edit in invoice and i get error . Quote
Blesta Addons Posted December 7, 2016 Author Report Posted December 7, 2016 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 . Quote
Tyson Posted December 8, 2016 Report Posted December 8, 2016 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. Quote
Paul Posted December 8, 2016 Report Posted December 8, 2016 Please check to see if you get this error in Beta 4. Quote
Blesta Addons Posted December 8, 2016 Author Report Posted December 8, 2016 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 . Quote
Blesta Addons Posted December 8, 2016 Author Report Posted December 8, 2016 is the debugger plugin .... but i don't know why he is returning a fatal error when debugging is set to true ? Quote
Paul Posted December 8, 2016 Report Posted December 8, 2016 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? Quote
Blesta Addons Posted December 8, 2016 Author Report Posted December 8, 2016 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 ); Quote
Tyson Posted December 9, 2016 Report Posted December 9, 2016 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. Quote
Paul Posted December 9, 2016 Report Posted December 9, 2016 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. activa 1 Quote
Blesta Addons Posted December 9, 2016 Author Report Posted December 9, 2016 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 !! Quote
Tyson Posted December 12, 2016 Report Posted December 12, 2016 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. Paul 1 Quote
Blesta Addons Posted December 13, 2016 Author Report Posted December 13, 2016 normally , in the plugin i use the default settings of Tracy debugger . Tracy is catching the error , as the above ode has try/catch . activa 1 Quote
Blesta Addons Posted November 2, 2017 Author Report Posted November 2, 2017 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 ); Quote
activa Posted November 3, 2017 Report Posted November 3, 2017 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. Quote
Blesta Addons Posted July 24, 2018 Author Report Posted July 24, 2018 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 . Quote
Tyson Posted July 24, 2018 Report Posted July 24, 2018 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. Quote
Blesta Addons Posted July 24, 2018 Author Report Posted July 24, 2018 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. Quote
Tyson Posted July 24, 2018 Report Posted July 24, 2018 47 minutes ago, Blesta Addons said: that isn't true. Sure it is, what you've described is exactly the behavior I am referring to. Blesta Addons 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.