Upon further investigation line 625:
$start = $startdate->format('Y-m-d');
$start_date is null after first iteration causing it to return Boolean false instead of the date.
Expected Behavior
The function should iterate through the loop and populate the $start_date with the start date of the task.
Actual Behavior
What actually happens is after the first loop, the $enddate_array[] is re-inialized causing it to be empty and thus causing the rest of the function to fail because a Boolean value false cannot be converted to a date.
$enddate_array = [];
is supposed to be inserted at line 330, but it's actually inserted on line 613
commenting it out at line 613 solves the problem and it works as expected.
Adding it back at line 330 causes no issues.
Steps to Reproduce
Create a project
Add a template with MORE than one task
Save the Project
500 error
Context
This bug prevents projects from being created from templates.
Your Environment
SuiteCRM Version used: 7.14.2
Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome
Environment name and version (e.g. MySQL, PHP 7): PHP 8.1
Operating System and version (e.g Ubuntu 16.04): Centos 7
Issue
When a project is created with a template a 500 error is generated:
Upon further investigation line 625:
$start = $startdate->format('Y-m-d');
$start_date is null after first iteration causing it to return Boolean false instead of the date.Expected Behavior
The function should iterate through the loop and populate the $start_date with the start date of the task.
Actual Behavior
What actually happens is after the first loop, the $enddate_array[] is re-inialized causing it to be empty and thus causing the rest of the function to fail because a Boolean value false cannot be converted to a date.
Possible Fix
I've reviewed this recent update. https://github.com/salesagility/SuiteCRM/commit/9aff7071bb86df7e06e2cf56aa3060fc00e3978a
Where:
$enddate_array = [];
is supposed to be inserted at line 330, but it's actually inserted on line 613 commenting it out at line 613 solves the problem and it works as expected. Adding it back at line 330 causes no issues.Steps to Reproduce
Context
This bug prevents projects from being created from templates.
Your Environment