Skip to content

fix: DatetimeCast gracefully handles string values#10401

Closed
gr8man wants to merge 1 commit into
codeigniter4:developfrom
gr8man:fix/datetime-cast
Closed

fix: DatetimeCast gracefully handles string values#10401
gr8man wants to merge 1 commit into
codeigniter4:developfrom
gr8man:fix/datetime-cast

Conversation

@gr8man

@gr8man gr8man commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description
Fixes #8302

When retrieving unmodified entities from the database, date fields may remain as raw strings rather than Time objects. This caused DataConverter to crash in DatetimeCast because it strictly expected Time objects.

This PR:

  1. Updates DatetimeCast::set() to gracefully parse strings into Time objects.
  2. Updates phpstan-baseline to fix CI failures.

This squashes several fixes regarding Entity::toRawArray returning string values instead of Time objects, addressing issue codeigniter4#8302. It also updates DatetimeCast to handle string values to prevent DataConverter crashes, and applies phpstan, rector, and cs-fix formatting.
@gr8man gr8man closed this Jul 9, 2026
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: Entity::toRawArray() may return Time object

1 participant