Skip to content

Fix Response crash when API response lacks time node#407

Merged
mesilov merged 3 commits intov3-devfrom
bugfix/343-nullable-time-in-response-data
Mar 29, 2026
Merged

Fix Response crash when API response lacks time node#407
mesilov merged 3 commits intov3-devfrom
bugfix/343-nullable-time-in-response-data

Conversation

@mesilov
Copy link
Copy Markdown
Collaborator

@mesilov mesilov commented Mar 27, 2026

Q A
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #343
License MIT

Some Bitrix24 API endpoints (e.g. documentation/v3) return a response without a time node.
The existing workaround set time to an empty array and then called Time::initFromResponse([]),
which triggered PHP errors on undefined array keys ($response['start'], etc.).

This fix adds Time::initWithZeroValues() — a static factory that fills all numeric fields with
0.0 and both date fields with CarbonImmutable::now(). Response::getResponseData() now calls
this factory instead of Time::initFromResponse([]) whenever the time node is absent or empty.

Test plan

  • make lint-cs-fixer — passed
  • make lint-rector — passed
  • make lint-phpstan — passed
  • make lint-deptrac — passed
  • make test-unit — passed (665 tests, 1151 assertions)

Closes #343

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mesilov mesilov added this to the 3.1.0 milestone Mar 27, 2026
@mesilov mesilov self-assigned this Mar 27, 2026
mesilov added 2 commits March 29, 2026 15:39
… responses (#343)

Signed-off-by: mesilov <mesilov.maxim@gmail.com>
…ll documentation (#NNN)

Signed-off-by: mesilov <mesilov.maxim@gmail.com>
@mesilov mesilov merged commit e75ebef into v3-dev Mar 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug in SDK]: add nullable attribute for time node in response for documentation

1 participant