#1603 - object to string conversion at Driver.php line 31.
You have object to string conversion at Driver.php line 31. Its triggered because not all fields are equals. A field in SugarCRM are sometimes a Link ( Relationship Object). Since SugarCRM 7s client facing codebase is mostly javascript - a fatal from php cause fatalities for the user
SugarChimp/includes/classes/SugarChimp/Field/Driver.php
You can make this problem go away by adding a condition before your code.
if( is_string($bean->$field) ) <your-code-is-here>
And another question is there a code-level flag to disable logging. Its flooding the logs with mostly useless garbage at the debug level.
Best of Regards Jonas
9 years ago
Hi Jonas, thanks for the info. I'll tweak that particular logging message. With Sugar 7 I would recommend turning off the display_errors flag in your php.ini and just log the php warnings/errors to the php log. This way you don't have to deal with it throwing 500 errors in the sugar client.
To have SugarChimp respect the Sugar logging level, you need to go to Sugar > Admin > SugarChimp Health Status and make sure the Logger Level is set to "Normal". If you set it to debug, it will log all SugarChimp logs to the fatal log. We do it this way so we can more easily support our Sugar On-demand customers. If you have the SugarChimp logger level set to "Normal", the SugarChimp logs will respect whatever the Sugar log level is set on. Is this what you needed for the SugarChimp debug messages?
Or are you wanting a way to turn of the SugarChimp log messages entirely? If you want this, then I would recommend editing modules/SugarChimp/includes/classes/SugarChimp/Helper.php find the "public static function log($level,$message)" method and put a "return true" at the top so it never logs things.
Let me know if you have any follow up comments. Thanks again!
9 years ago
Thanks for quick response. I would prefer a fix of logging where we do not have to alter your plugin. Since that exposes us to 'own' to any future problems caused by the sugarchimp addon. So for the next release if you where to be so kind to add something like the following where you ask me to add return. That would be super. :)
display_errors is off is production. Exception handling however can be tricky. Uncatched fatal error during save kills the execution and opens up for data-loss. And someone can have registered their own error handler bypassing php default and voiding settings of error_reporting. With so many plugins in the eco-system its hard to know.
Its the unknown situations that are hard to test for, the human aspect of software development and its OK but unfortunate. You can use set-error-handler where execution of your code starts and then restore_error_handler to revert to previous error handler for the production scenario. Its the data-loss / failure to trigger business logic that creates dangerous real-world complications.
Its less than optimal and would require your code respect the children of SugarException / SugarApiException. You probably should implement dynamic exception handling with some registry for everyone to register their own custom errors. That should probably be as a shared library on the Sugar Outfitters level.
And of-course it would open up for new unknown problems.But maybe improving the robustness and test-ability of the code. You want fatal to be respected and killing the execution but you only want this when its really a fatal such as business condition not fulfilled.
Once again thanks for quick reply.
Best of Regards
Jonas
9 years ago
Hi Jonas, I really appreciate you taking the time to step through your suggestions. A lot of good stuff there.
We'll add the ability for developers via the Sugar Config table to turn of SugarChimp logging. I'll followup here when we get it released.
Thanks!
9 years ago
Hi Jonas, in the latest SugarChimp release we added a flag so that you can turn off SugarChimp logging completely.
All you need to do is download the latest package from SugarOutfitters https://www.sugaroutfitters.com/orders then go to Sugar > Admin > Module Loader, upload and install the zip file. There is no need to uninstall your current version of SugarChimp. This will not affect any of your current settings. Once you reach the License Validation page, click Validate and you are done.
After upgrading, you can set the sugarchimp.logging_enabled to false and SugarChimp will no longer long anything.
I'm going to close this case for now, but let us know if something doesn't work as expected. Thanks!