Workflow 500 Error from Object of class Link2 could not be converted to string in data/SugarBean.php on line 4528

In 2018, i upgraded from an older version of SuiteCRM to 7.10.10. One of the issues I identified was an HTTP 500 error in workflow, in some instances, that was a result of the code used to support project templates. I don’t use project templates, BTW.

I had added some code to determine if it was a string, which got rid of the error. Of course, 2 years later applying upgrades again, this broke again.

I beleive, as far as SuiteCRM users go, we use Projects more than most folks, so I’m not sure if this is some sort of bug or a result of upgrades/changes/modifications.

What I had to do was change this:

    if ($current_template_id != $new_template_id) {
        $project_start = $focus->estimated_start_date;

to this:

            if (((is_object($new_template_id) && method_exists($new_template_id, '__toString')) || is_string($new_template_id)) && $current_template_id != $new_template_id) {
        $project_start = $focus->estimated_start_date;

If anyone knows what is up here, feel free to let me know.

Hello!

To which page you applied the change?

A quick code search turns up this place:

Didn’t work for me. =(

If you have an error 500, you should be checking your PHP log to see what it is.

That is the log defined in the error_log directive in your php.ini.