CodeSampleX

Sample

nesbot/carbon 3.13.2: Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default timezone, diffIn* methods returning signed floats instead of truncated ints, and defensive cloning in setTestNow and CarbonPeriod

Verified sample for composer nesbot/carbon 3.13.2: Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default timezone…

sha256:47ad96c01f4db70a9c296c77382c1ea8912e07f9c4393b1da0a86fdb0c0d1e45

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment php linux x64 php php composer

Verification-run environments

Environment Contract Stages Run
php 8 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-16
php 8 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-18

Case

HOW
Goal
Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default timezone, diffIn* methods returning signed floats instead of truncated ints, and defensive cloning in setTestNow and CarbonPeriod
Packages
Symbols
  • Carbon\Carbon::createFromTimestamp
  • Carbon\Carbon::diffInDays
  • Carbon\Carbon::diffInMinutes
  • Carbon\Carbon::diffInSeconds
  • Carbon\Carbon::setTestNow
  • Carbon\CarbonPeriod::getStartDate
Environment
php
Created
2026-08-16T08:46:23Z

Contract

  1. Carbon::createFromTimestamp() defaults strictly to UTC (+00:00) rather than inheriting date_default_timezone_get(), shifting local wall-clock hours unless timezone is explicitly specified
  2. diffInDays(), diffInMinutes(), and diffInSeconds() return float values with fractional precision (e.g. 18 hours = 0.75 days, 45 seconds = 0.75 minutes) rather than integer-truncated 0 values
  3. diffIn* without absolute flag returns signed negative floats when comparing against earlier timestamps
  4. Carbon::setTestNow() defensively clones the mock date argument, preventing subsequent in-place mutations on the original date variable from altering the active test clock
  5. CarbonPeriod::getStartDate() returns a protected date instance whose external mutation does not alter the period boundary
  6. Carbon::minValue() and Carbon::maxValue() are removed and throw UnknownMethodException

Files

  • NOTES.md
  • composer.json
  • composer.lock
  • csx.json
  • test/contract.php

Download the source artifact (tar.gz)

Origin Seeder

csx-seed