Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The follow code fails with the error message: "Notice: Undefined offset: 0 in /Users/carlfredrikhero/Web/PHP/AdvancedWebform/vendor/podio/podio-php/models/PodioItemField.php on line 385"
I can't determine which, but one of the magic set methods sets the value to an empty array, adding !empty($values) solves the issue. There probably is a better way but I can't find it right now.
Here's the relevant stack trace:
#0 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/models/PodioItemField.php(386): Slim\Slim::handleErrors(8, 'Undefined offse...', '/var/vhosts/adv...', 386, Array)
#1 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/models/PodioItemField.php(403): PodioDateItemField->__get('values')
#2 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/models/PodioItemField.php(579): PodioDateItemField->__get('start')
#3 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/models/PodioItemField.php(46): PodioDateItemField->api_friendly_values()
#4 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/lib/PodioObject.php(318): PodioItemField->as_json(false)
#5 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/models/PodioItem.php(81): PodioObject->as_json(false)
#6 /var/vhosts/advancedwebform.com/vendor/podio/podio-php/models/PodioItem.php(59): PodioItem->as_json_without_readonly_fields()
#7 /var/vhosts/advancedwebform.com/vendor/elvenite/advanced-webform/src/AdvancedWebform.php(900): PodioItem->save()
So why do I try to set the value to a null value? Setting the value to null ensures that the value is actually empty, if I don't set the value, the field will be unchanged. This works for all other field types.