Casting to array in FormalExpression (arrayget) - FOUR-7094
Issue & Reproduction Steps
This bug was encountered during the PM4EH-184 task.
It was expected that the process would only move forward after receiving the callback call.
In the process that manages the Data Connector implementation, there is a gateway that checks for a callback. In the "Yes" path, there is a FormalExpression that fails, even though there is a callback in the parent process. This takes the process in the wrong flow, causing the bug.
I suspect it's not a regression issue and that this function has never worked, following the evidence below.
https://github.com/ProcessMaker/processmaker/commit/83993df2eebe2d62ea97bcec8210f5d9efce450c
https://github.com/laravel/framework/blob/6.x/src/Illuminate/Support/Arr.php#L284
Solution
Cast to array before calling Arr::get.
How to Test
Run the command:
php vendor/phpunit/phpunit/phpunit --colors --stop-on-failure tests/unit/ProcessMaker/Models/FormalExpressionTest.php --filter=testArrayGet
Another test can be done by following the "Steps to Reproduce" in this ticket FOUR-7094.
Related Tickets & Packages
Code Review Checklist
- [ ] I have pulled this code locally and tested it on my instance, along with any associated packages.
- [ ] This code adheres to ProcessMaker Coding Guidelines.
- [ ] This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
- [ ] This solution fixes the bug reported in the original ticket.
- [ ] This solution does not alter the expected output of a component in a way that would break existing Processes.
- [ ] This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
- [ ] This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
- [ ] This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
- [ ] This ticket conforms to the PRD associated with this part of ProcessMaker.