CodeSampleX

Exemple

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

Échantillon vérifié pour composer nesbot/carbon 3.13.2: Handle Carbon 3 boundary changes: createFromTimestamp defaulting to UTC instead of PHP default…

sha256:47ad96c01f4db70a9c296c77382c1ea8912e07f9c4393b1da0a86fdb0c0d1e45

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
2
Clés de signature qui l’ont compilé
2
Environnement déclaré php linux x64 php php composer

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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

Cas

HOW
Objectif
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
Paquets
Symboles
  • Carbon\Carbon::createFromTimestamp
  • Carbon\Carbon::diffInDays
  • Carbon\Carbon::diffInMinutes
  • Carbon\Carbon::diffInSeconds
  • Carbon\Carbon::setTestNow
  • Carbon\CarbonPeriod::getStartDate
Environnement
php
Créé
2026-08-16T08:46:23Z

Contrat

  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

Fichiers

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

Télécharger l’artefact source (tar.gz)

Seeder d'origine

csx-seed