Exemple
doctrine/dbal 4.4.4: Query an in-memory SQLite through Doctrine DBAL 4 without the parameter binding, empty result and schema introspection traps
Échantillon vérifié pour composer doctrine/dbal 4.4.4: Query an in-memory SQLite through Doctrine DBAL 4 without the parameter binding, empty result and…
sha256:090b8a4df8ed4282fa66e190d2a7e4a2c1611b82a538304c73a2585e29fa9c7a
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
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
php 8 linux x64 php 8 php composer
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| php 8 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · composer@1 |
2026-08-14 |
Cas
HOW- Objectif
- Query an in-memory SQLite through Doctrine DBAL 4 without the parameter binding, empty result and schema introspection traps
- Paquets
- Symboles
-
- Doctrine.DBAL.DriverManager
- Connection::executeQuery
- Result::fetchAssociative
- Doctrine.DBAL.ParameterType
- Doctrine.DBAL.ArrayParameterType
- QueryBuilder::createNamedParameter
- QueryBuilder::setParameter
- AbstractSchemaManager::introspectTable
- Type::lookupName
- Environnement
- php 8
- Créé
- 2026-08-14T20:22:50Z
Contrat
- assert positional parameters are bound in the order the array was built and never by its keys, so two arrays that are == with the same keys give different answers and ksort alone changes the result
- assert named parameters are resolved by name so the order they were set in cannot matter, and that a 1-based or nonsense-keyed positional array still works because no key is ever read
- assert named and positional placeholders can be mixed in one statement despite the manual saying they cannot, and that whether the SQL parser runs at all is decided by is_string on the first key of the params array
- assert that same switch decides whether a bad parameter list raises MissingNamedParameter or MissingPositionalParameter or instead reaches the driver as SQLSTATE column index out of range, and that a surplus named value is silently unused
- assert fetchAssociative returns false rather than null when the result is exhausted so the ?? guard never fires, and that fetchOne returns false for no row but int 0 for a stored zero, which are == but not ===
- assert fetchAllAssociative spells the same emptiness as an empty array instead, and that rowCount reports 0 for a SELECT on pdo_sqlite so counting has to happen in SQL
- assert a wrong ParameterType rewrites the value instead of failing: '0012' bound as INTEGER is stored as '12', 'abc' becomes 0, 2.9 truncates to 2, and false bound as STRING becomes the empty string rather than '0'
- assert that mistake still matches on an INTEGER column because SQLite applies column affinity to the comparison, and matches nothing against a text column, which is why it survives the read path and only corrupts writes
- assert an IN clause needs createNamedParameter with an ArrayParameterType, that the single placeholder is expanded into one ? per element inside executeQuery rather than by the builder, and that an empty list becomes the literal NULL
- assert expr()->in with a raw array interpolates the values into the SQL and dies on 'no such column' for strings, that setParameter with an array and the default type only raises a PHP 'Array to string conversion' warning and matches nothing, and that a scalar ParameterType casts the array to 1 with no diagnostic at all
- assert setParameter binds a value without adding a placeholder, so a parameter whose placeholder is missing from the SQL is discarded without complaint
- assert schema introspection returns datetime for datetime_immutable, text for json and simple_array, and a fixed string(36) for guid, while length, precision, scale and autoincrement do survive the round trip
- assert the Comparator still calls the two schemas identical and emits no ALTER because it compares the generated DDL rather than the Doctrine type, so the loss surfaces only in convertToPHPValue handing back a mutable DateTime and an undecoded JSON string
- assert introspecting a declared type with no mapping raises InvalidArgumentException instead of falling back to string, and that Type::getName is gone in DBAL 4 in favour of the static Type::lookupName
Fichiers
- composer.json
- composer.lock
- csx.json
- phpunit.xml
- src/Ledger.php
- test/LedgerTest.php
Code source
{
"name": "csx/doctrine-dbal-sqlite",
"license": "MIT-0",
"require": {
"doctrine/dbal": "4.4.4"
},
"require-dev": {
"phpunit/phpunit": "13.3.1"
},
"autoload": {
"psr-4": {
"Csx\\": "src/"
}
},
"config": {
"platform": {
"php": "8.5.0"
}
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "a0c77828b966e31d45220502075cbc12",
"packages": [
{
"name": "doctrine/dbal",
"version": "4.4.4",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "fb9e0ffe15e1590e24dc61c0c0a23f9a33ee42ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/fb9e0ffe15e1590e24dc61c0c0a23f9a33ee42ce",
"reference": "fb9e0ffe15e1590e24dc61c0c0a23f9a33ee42ce",
"shasum": ""
},
"require": {
"doctrine/deprecations": "^1.1.5",
"php": "^8.2",
"psr/cache": "^1|^2|^3",
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "14.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.2",
"phpstan/phpstan": "2.1.30",
"phpstan/phpstan-phpunit": "2.0.7",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "11.5.50",
"slevomat/coding-standard": "8.27.1",
"squizlabs/php_codesniffer": "4.0.1",
"symfony/cache": "^6.3.8|^7.0|^8.0",
"symfony/console": "^5.4|^6.3|^7.0|^8.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlite",
"sqlserver",
"sqlsrv"
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/4.4.4"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2026-07-21T14:34:40+00:00"
},
{
"name": "doctrine/deprecations",
"version": "1.1.6",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca",
"reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"phpunit/phpunit": "<=7.5 || >=14"
},
"require-dev": {
"doctrine/coding-standard": "^9 || ^12 || ^14",
"phpstan/phpstan": "1.4.10 || 2.1.30",
"phpstan/phpstan-phpunit": "^1.0 || ^2",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0",
"psr/log": "^1 || ^2 || ^3"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Deprecations\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/1.1.6"
},
"time": "2026-02-07T07:09:04+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/log",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"time": "2024-09-11T13:17:53+00:00"
}
],
"packages-dev": [
{
"name": "myclabs/deep-copy",
"version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
"reference": "8680aa248f8e07bc8fb43f56f0f5fc77a0c96aae",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
"files": [
"src/DeepCopy/deep_copy.php"
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.14.0"
},
"funding": [
{
"url": "https://github.com/mnapoli",
"type": "github"
}
],
"time": "2026-08-11T10:17:44+00:00"
},
{
"name": "nikic/php-parser",
"version": "v5.8.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.4"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^9.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.x-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0"
},
"time": "2026-07-04T14:30:18+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "54750ef60c58e43759730615a392c31c80e23176"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
"reference": "54750ef60c58e43759730615a392c31c80e23176",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-phar": "*",
"ext-xmlwriter": "*",
"phar-io/version": "^3.0.1",
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/2.0.4"
},
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2024-03-03T12:33:53+00:00"
},
{
"name": "phar-io/version",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.2.1"
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "14.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "060a5c93e81afb01e97dbe8930a5d0c9bd46e54e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/060a5c93e81afb01e97dbe8930a5d0c9bd46e54e",
"reference": "060a5c93e81afb01e97dbe8930a5d0c9bd46e54e",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^5.8.0",
"php": ">=8.4",
"phpunit/php-text-template": "^6.0",
"sebastian/complexity": "^6.0",
"sebastian/environment": "^9.3.2",
"sebastian/git-state": "^1.0",
"sebastian/lines-of-code": "^5.0.2",
"sebastian/version": "^7.0",
"theseer/tokenizer": "^2.0.1"
},
"require-dev": {
"phpunit/phpunit": "^13.3"
},
"suggest": {
"ext-pcov": "PHP extension that provides line coverage",
"ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "14.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/14.3.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage",
"type": "tidelift"
}
],
"time": "2026-08-07T07:24:15+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "7.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "3ccaa29123548190af12fee7af078dcd7f3ddfab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3ccaa29123548190af12fee7af078dcd7f3ddfab",
"reference": "3ccaa29123548190af12fee7af078dcd7f3ddfab",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "7.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/7.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator",
"type": "tidelift"
}
],
"time": "2026-08-10T06:43:12+00:00"
},
{
"name": "phpunit/php-invoker",
"version": "7.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-invoker.git",
"reference": "42e5c5cae0c65df12d1b1a3ab52bf3f50f244d88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/42e5c5cae0c65df12d1b1a3ab52bf3f50f244d88",
"reference": "42e5c5cae0c65df12d1b1a3ab52bf3f50f244d88",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"ext-pcntl": "*",
"phpunit/phpunit": "^13.0"
},
"suggest": {
"ext-pcntl": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "7.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Invoke callables with a timeout",
"homepage": "https://github.com/sebastianbergmann/php-invoker/",
"keywords": [
"process"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-invoker/issues",
"security": "https://github.com/sebastianbergmann/php-invoker/security/policy",
"source": "https://github.com/sebastianbergmann/php-invoker/tree/7.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/php-invoker",
"type": "tidelift"
}
],
"time": "2026-02-06T04:34:47+00:00"
},
{
"name": "phpunit/php-text-template",
"version": "6.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "a47af19f93f76aa3368303d752aa5272ca3299f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/a47af19f93f76aa3368303d752aa5272ca3299f4",
"reference": "a47af19f93f76aa3368303d752aa5272ca3299f4",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
"security": "https://github.com/sebastianbergmann/php-text-template/security/policy",
"source": "https://github.com/sebastianbergmann/php-text-template/tree/6.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/php-text-template",
"type": "tidelift"
}
],
"time": "2026-02-06T04:36:37+00:00"
},
{
"name": "phpunit/php-timer",
"version": "9.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "a0e12065831f6ab0d83120dc61513eb8d9a966f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/a0e12065831f6ab0d83120dc61513eb8d9a966f6",
"reference": "a0e12065831f6ab0d83120dc61513eb8d9a966f6",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
"security": "https://github.com/sebastianbergmann/php-timer/security/policy",
"source": "https://github.com/sebastianbergmann/php-timer/tree/9.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/php-timer",
"type": "tidelift"
}
],
"time": "2026-02-06T04:37:53+00:00"
},
{
"name": "phpunit/phpunit",
"version": "13.3.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "fc024931d6ad047404e9d86536735923fe63a06b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc024931d6ad047404e9d86536735923fe63a06b",
"reference": "fc024931d6ad047404e9d86536735923fe63a06b",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-filter": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.14.0",
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
"php": ">=8.4.1",
"phpunit/php-code-coverage": "^14.3",
"phpunit/php-file-iterator": "^7.0.1",
"phpunit/php-invoker": "^7.0.0",
"phpunit/php-text-template": "^6.0.0",
"phpunit/php-timer": "^9.0.0",
"sebastian/cli-parser": "^5.0.1",
"sebastian/comparator": "^8.4",
"sebastian/diff": "^9.0",
"sebastian/environment": "^9.3.2",
"sebastian/exporter": "^8.2.1",
"sebastian/file-filter": "^1.0",
"sebastian/git-state": "^1.0",
"sebastian/global-state": "^9.0.1",
"sebastian/object-enumerator": "^8.1.0",
"sebastian/recursion-context": "^8.0.1",
"sebastian/type": "^7.0.2",
"sebastian/version": "^7.0.0",
"staabm/side-effects-detector": "^1.0.5"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "13.3-dev"
}
},
"autoload": {
"files": [
"src/Framework/Assert/Functions.php"
],
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/13.3.1"
},
"funding": [
{
"url": "https://phpunit.de/sponsoring.html",
"type": "other"
}
],
"time": "2026-08-13T13:14:23+00:00"
},
{
"name": "sebastian/cli-parser",
"version": "5.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/cli-parser.git",
"reference": "eeb759ad3146b7096fb59c3195d39e071cd409e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/eeb759ad3146b7096fb59c3195d39e071cd409e3",
"reference": "eeb759ad3146b7096fb59c3195d39e071cd409e3",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.2.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "5.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for parsing CLI options",
"homepage": "https://github.com/sebastianbergmann/cli-parser",
"support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
"security": "https://github.com/sebastianbergmann/cli-parser/security/policy",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/5.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/cli-parser",
"type": "tidelift"
}
],
"time": "2026-08-01T04:27:14+00:00"
},
{
"name": "sebastian/comparator",
"version": "8.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "3b070e608146cba00fd6fd1f0ffba89e5a8897fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/3b070e608146cba00fd6fd1f0ffba89e5a8897fb",
"reference": "3b070e608146cba00fd6fd1f0ffba89e5a8897fb",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-mbstring": "*",
"php": ">=8.4",
"sebastian/diff": "^9.0",
"sebastian/exporter": "^8.2"
},
"require-dev": {
"phpunit/phpunit": "^13.3"
},
"suggest": {
"ext-bcmath": "For comparing BcMath\\Number objects"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "8.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"security": "https://github.com/sebastianbergmann/comparator/security/policy",
"source": "https://github.com/sebastianbergmann/comparator/tree/8.4.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/comparator",
"type": "tidelift"
}
],
"time": "2026-08-07T07:23:13+00:00"
},
{
"name": "sebastian/complexity",
"version": "6.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git",
"reference": "c5651c795c98093480df79350cb050813fc7a2f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c5651c795c98093480df79350cb050813fc7a2f3",
"reference": "c5651c795c98093480df79350cb050813fc7a2f3",
"shasum": ""
},
"require": {
"nikic/php-parser": "^5.0",
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for calculating the complexity of PHP code units",
"homepage": "https://github.com/sebastianbergmann/complexity",
"support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues",
"security": "https://github.com/sebastianbergmann/complexity/security/policy",
"source": "https://github.com/sebastianbergmann/complexity/tree/6.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/complexity",
"type": "tidelift"
}
],
"time": "2026-02-06T04:41:32+00:00"
},
{
"name": "sebastian/diff",
"version": "9.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "a3fb6a298a265ff487a91bbea46e03cd01dbb226"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/a3fb6a298a265ff487a91bbea46e03cd01dbb226",
"reference": "a3fb6a298a265ff487a91bbea46e03cd01dbb226",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.2",
"symfony/process": "^7.4.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff",
"udiff",
"unidiff",
"unified diff"
],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/9.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/diff",
"type": "tidelift"
}
],
"time": "2026-06-05T03:04:51+00:00"
},
{
"name": "sebastian/environment",
"version": "9.3.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6c9e487c9eb706a8d258102a1c0b0a3e53e86c2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6c9e487c9eb706a8d258102a1c0b0a3e53e86c2e",
"reference": "6c9e487c9eb706a8d258102a1c0b0a3e53e86c2e",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.1.11"
},
"suggest": {
"ext-posix": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.3-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "https://github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"security": "https://github.com/sebastianbergmann/environment/security/policy",
"source": "https://github.com/sebastianbergmann/environment/tree/9.3.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/environment",
"type": "tidelift"
}
],
"time": "2026-05-25T13:41:38+00:00"
},
{
"name": "sebastian/exporter",
"version": "8.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "24a3b69bba4a12ab615fca9d34680c5598d9ab7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/24a3b69bba4a12ab615fca9d34680c5598d9ab7a",
"reference": "24a3b69bba4a12ab615fca9d34680c5598d9ab7a",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=8.4",
"sebastian/recursion-context": "^8.0.1"
},
"require-dev": {
"phpunit/phpunit": "^13.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "8.2-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "https://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"security": "https://github.com/sebastianbergmann/exporter/security/policy",
"source": "https://github.com/sebastianbergmann/exporter/tree/8.2.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/exporter",
"type": "tidelift"
}
],
"time": "2026-08-07T07:22:06+00:00"
},
{
"name": "sebastian/file-filter",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/file-filter.git",
"reference": "33a26f394330f6faa7684bb9cc73afb7727aae93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/file-filter/zipball/33a26f394330f6faa7684bb9cc73afb7727aae93",
"reference": "33a26f394330f6faa7684bb9cc73afb7727aae93",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for filtering files",
"homepage": "https://github.com/sebastianbergmann/file-filter",
"support": {
"issues": "https://github.com/sebastianbergmann/file-filter/issues",
"security": "https://github.com/sebastianbergmann/file-filter/security/policy",
"source": "https://github.com/sebastianbergmann/file-filter/tree/1.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/file-filter",
"type": "tidelift"
}
],
"time": "2026-04-22T07:20:04+00:00"
},
{
"name": "sebastian/git-state",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/git-state.git",
"reference": "792a952e0eba55b6960a48aeceb9f371aad1f76b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/git-state/zipball/792a952e0eba55b6960a48aeceb9f371aad1f76b",
"reference": "792a952e0eba55b6960a48aeceb9f371aad1f76b",
"shasum": ""
},
"require": {
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for describing the state of a Git checkout",
"homepage": "https://github.com/sebastianbergmann/git-state",
"support": {
"issues": "https://github.com/sebastianbergmann/git-state/issues",
"security": "https://github.com/sebastianbergmann/git-state/security/policy",
"source": "https://github.com/sebastianbergmann/git-state/tree/1.0.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/git-state",
"type": "tidelift"
}
],
"time": "2026-03-21T12:54:28+00:00"
},
{
"name": "sebastian/global-state",
"version": "9.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "ba68ba79da690cf7eddefd3ce5b78b20b9ba9945"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ba68ba79da690cf7eddefd3ce5b78b20b9ba9945",
"reference": "ba68ba79da690cf7eddefd3ce5b78b20b9ba9945",
"shasum": ""
},
"require": {
"php": ">=8.4",
"sebastian/object-reflector": "^6.0",
"sebastian/recursion-context": "^8.0"
},
"require-dev": {
"ext-dom": "*",
"phpunit/phpunit": "^13.1.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "9.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "https://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"security": "https://github.com/sebastianbergmann/global-state/security/policy",
"source": "https://github.com/sebastianbergmann/global-state/tree/9.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/global-state",
"type": "tidelift"
}
],
"time": "2026-06-01T15:11:33+00:00"
},
{
"name": "sebastian/lines-of-code",
"version": "5.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
"reference": "d1b6f8fce682505dbd048977f1abedf1b8ad3ff8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d1b6f8fce682505dbd048977f1abedf1b8ad3ff8",
"reference": "d1b6f8fce682505dbd048977f1abedf1b8ad3ff8",
"shasum": ""
},
"require": {
"nikic/php-parser": "^5.8.0",
"php": ">=8.4"
},
"require-dev": {
"phpunit/phpunit": "^13.2.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "5.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for counting the lines of code in PHP source code",
"homepage": "https://github.com/sebastianbergmann/lines-of-code",
"support": {
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
"security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/5.0.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/sebastian/lines-of-code",
"type": "tidelift"
}
],
"time": "2026-07-09T08:42:34+00:00"
},
{
"name": "sebastian/object-enumerator",
"version": "8.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "511064ecde82bd747e2ba2fab3dda8d977b59576"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/511064ecde82bd747e2ba2fab3dda8d977b59576",
"reference": "511064ecde82bd747e2ba2fab3dda8d977b59576",
"shasum": ""
},
"require": {
"php": ">=8.4",
"sebastian/recursion-context": "^8.0.1"
},
"require-dev": {
"phpunit/phpunit": "^13.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "8.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"security": "https://github.com/sebastianbergmann/object-enumerator/security/policy",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/8.1.0"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianber
{"case":{"caseId":"case:sha256:412c23e97d805e8ef402a09f6a2aa83b128ef10646facda65c21d6f5e1367a3b","constraints":{"runtime":"php"},"contract":["assert positional parameters are bound in the order the array was built and never by its keys, so two arrays that are == with the same keys give different answers and ksort alone changes the result","assert named parameters are resolved by name so the order they were set in cannot matter, and that a 1-based or nonsense-keyed positional array still works because no key is ever read","assert named and positional placeholders can be mixed in one statement despite the manual saying they cannot, and that whether the SQL parser runs at all is decided by is_string on the first key of the params array","assert that same switch decides whether a bad parameter list raises MissingNamedParameter or MissingPositionalParameter or instead reaches the driver as SQLSTATE column index out of range, and that a surplus named value is silently unused","assert fetchAssociative returns false rather than null when the result is exhausted so the ?? guard never fires, and that fetchOne returns false for no row but int 0 for a stored zero, which are == but not ===","assert fetchAllAssociative spells the same emptiness as an empty array instead, and that rowCount reports 0 for a SELECT on pdo_sqlite so counting has to happen in SQL","assert a wrong ParameterType rewrites the value instead of failing: '0012' bound as INTEGER is stored as '12', 'abc' becomes 0, 2.9 truncates to 2, and false bound as STRING becomes the empty string rather than '0'","assert that mistake still matches on an INTEGER column because SQLite applies column affinity to the comparison, and matches nothing against a text column, which is why it survives the read path and only corrupts writes","assert an IN clause needs createNamedParameter with an ArrayParameterType, that the single placeholder is expanded into one ? per element inside executeQuery rather than by the builder, and that an empty list becomes the literal NULL","assert expr()-\u003ein with a raw array interpolates the values into the SQL and dies on 'no such column' for strings, that setParameter with an array and the default type only raises a PHP 'Array to string conversion' warning and matches nothing, and that a scalar ParameterType casts the array to 1 with no diagnostic at all","assert setParameter binds a value without adding a placeholder, so a parameter whose placeholder is missing from the SQL is discarded without complaint","assert schema introspection returns datetime for datetime_immutable, text for json and simple_array, and a fixed string(36) for guid, while length, precision, scale and autoincrement do survive the round trip","assert the Comparator still calls the two schemas identical and emits no ALTER because it compares the generated DDL rather than the Doctrine type, so the loss surfaces only in convertToPHPValue handing back a mutable DateTime and an undecoded JSON string","assert introspecting a declared type with no mapping raises InvalidArgumentException instead of falling back to string, and that Type::getName is gone in DBAL 4 in favour of the static Type::lookupName"],"goal":"Query an in-memory SQLite through Doctrine DBAL 4 without the parameter binding, empty result and schema introspection traps","kind":"HOW","packages":["pkg:composer/doctrine/dbal@4.4.4"],"schemaVersion":1,"symbols":["Doctrine.DBAL.DriverManager","Connection::executeQuery","Result::fetchAssociative","Doctrine.DBAL.ParameterType","Doctrine.DBAL.ArrayParameterType","QueryBuilder::createNamedParameter","QueryBuilder::setParameter","AbstractSchemaManager::introspectTable","Type::lookupName"]},"contractCommand":["php","vendor/bin/phpunit","--colors=never"],"environment":{"arch":"x64","ecosystem":"composer","executionContext":"php","language":"php","os":"linux","packageManager":"composer","runtime":"php","runtimeVersion":"8","schemaVersion":1},"license":"MIT-0","packages":["pkg:composer/doctrine/dbal@4.4.4"],"schemaVersion":1,"symbols":["Doctrine.DBAL.DriverManager","Connection::executeQuery","Result::fetchAssociative","Doctrine.DBAL.ParameterType","Doctrine.DBAL.ArrayParameterType","QueryBuilder::createNamedParameter","QueryBuilder::setParameter","AbstractSchemaManager::introspectTable","Type::lookupName"],"verifierAdapter":"composer@1"}
<?xml version="1.0"?>
<phpunit bootstrap="vendor/autoload.php" colors="false" recordTestRunHistory="false">
<testsuites><testsuite name="csx"><directory>test</directory></testsuite></testsuites>
</phpunit>
<?php
namespace Csx;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
/**
* Doctrine DBAL 4 against an in-memory SQLite, and the five places where it
* does something other than what the call site says. All five were measured on
* dbal 4.4.4 / PHP 8.5.9; where a measurement contradicted the documentation
* the measurement is what is written down here.
*
* 1. Positional parameters are bound in the order the array was BUILT, not by
* its keys. Connection::expandArrayParameters only parses the SQL when
* `is_string(key($params))` is true or some type is an ArrayParameterType.
* Otherwise nothing ever looks at a key: bindParameters() walks the array in
* insertion order and binds to 1, 2, 3... So [0 => 2, 1 => 20] and
* [1 => 20, 0 => 2] are the same array to array_key_exists and to ksort, and
* a different query to DBAL — the second one silently matches no rows. Keys
* being ignored is also why a 1-based array, or [9 => .., 4 => ..], "works".
* Named parameters go through the parser and are resolved by name, so they
* are immune. Bind by name.
*
* 2. The docs say "You cannot mix the positional and the named approach."
* Measured on 4.4.4, you can, and that is worse than not being able to.
* When the first key is a string the parser runs, rewrites every placeholder
* (named and positional alike) to `?`, and resolves each one properly — so
* `id = :id AND qty = ?` with ['id' => 2, 0 => 20] returns the right row.
* Build the same array int-key-first and the parser never runs, the values
* are bound in insertion order against SQLite's own placeholder numbering,
* and you get a different answer from the same statement and the same
* values. Same switch decides whether a missing parameter is caught:
* parser on, you get MissingNamedParameter or MissingPositionalParameter;
* parser off, you get either the wrong row or SQLSTATE HY000 "column index
* out of range" from the driver.
*
* 3. fetchAssociative() and fetchOne() return FALSE on exhaustion, not null.
* `$row ?? $default` therefore never fires, and `if (!$value)` cannot tell a
* missing row from a stored 0 — fetchOne() returns int 0 for a real zero and
* bool false for no row, which are == but not ===. firstRow() below is the
* one-line bridge; write it once instead of at every call site.
*
* 4. A wrong ParameterType does not fail, it rewrites the value. Bound with
* ParameterType::INTEGER, '0012' is stored as '12' (leading zeros gone),
* 'abc' becomes 0, and 2.9 becomes 2. Bound with ParameterType::STRING,
* false becomes '' rather than '0'. Nothing warns. It hides on reads,
* because SQLite applies column affinity when comparing against an INTEGER
* column, so `WHERE id = ?` matches whichever type you declared; it only
* bites on writes and on TEXT columns.
*
* 5. An IN clause needs createNamedParameter() plus ArrayParameterType, and
* each way of getting it wrong fails differently:
* - expr()->in('id', [1, 3]) interpolates the values into the SQL. It
* returns rows, so it looks correct — it is string concatenation, and
* with strings it emits `name IN (alpha, gamma)` and dies on "no such
* column: alpha". Never pass user input to it.
* - setParameter('ids', [1, 3]) with the default STRING type raises a PHP
* "Array to string conversion" warning, runs, and matches nothing.
* - createNamedParameter([1, 3], ParameterType::INTEGER) casts the array
* to int 1 with no diagnostic at all and silently queries IN (1).
* Only ArrayParameterType makes ExpandArrayParameters expand the placeholder
* into one `?` per element. An empty list becomes the literal NULL, so
* IN (NULL) matches nothing instead of being a syntax error.
*
* 6. Schema introspection does not give back the type it was given.
* datetime_immutable comes back as datetime, json and simple_array as text,
* guid as string(36) fixed. SQLite stores a declared type name, not a
* Doctrine type, and SQLitePlatform's mapping is many-to-one.
* The part that surprises: the Comparator says the two schemas are
* IDENTICAL and generates no ALTER, because it compares the generated DDL
* and both sides emit `created DATETIME NOT NULL`. So there is no phantom
* migration to warn you. The loss only appears when something uses the
* introspected type to convert values: convertToPHPValue then hands back a
* mutable DateTime instead of a DateTimeImmutable, and the raw string
* '{"a":1}' instead of the decoded array. A tool that introspects the
* database to build its own type map is the one that gets hurt.
* Introspection also throws outright on a declared type it has no mapping
* for: `MONEY` raises InvalidArgumentException, not a fallback to string.
*/
final class Ledger
{
public const TABLE = 'orders';
/**
* ':memory:' is scoped to the connection, so every Connection built here
* gets its own empty database and tests cannot leak into each other.
*/
public static function connect(): Connection
{
return DriverManager::getConnection(['driver' => 'pdo_sqlite', 'memory' => true]);
}
/**
* Builds the table through the Schema API and returns the Table that was
* intended, so a caller can hold it next to the one introspection gives
* back. The four nullable columns exist to be round-tripped.
*/
public static function migrate(Connection $conn): Table
{
$schema = new Schema();
$table = $schema->createTable(self::TABLE);
$table->addColumn('id', Types::INTEGER, ['autoincrement' => true]);
$table->addColumn('reference', Types::STRING, ['length' => 32]);
$table->addColumn('quantity', Types::INTEGER);
$table->addColumn('placed_at', Types::DATETIME_IMMUTABLE, ['notnull' => false]);
$table->addColumn('metadata', Types::JSON, ['notnull' => false]);
$table->addColumn('tags', Types::SIMPLE_ARRAY, ['notnull' => false]);
$table->addColumn('external_id', Types::GUID, ['notnull' => false]);
$table->addColumn('amount', Types::DECIMAL, ['precision' => 10, 'scale' => 2, 'notnull' => false]);
$table->setPrimaryKey(['id']);
foreach ($conn->getDatabasePlatform()->getCreateTableSQL($table) as $ddl) {
$conn->executeStatement($ddl);
}
return $table;
}
/**
* Named parameters and an explicit type for every one of them. Because the
* keys are strings the SQL parser runs, which is what makes the argument
* order here irrelevant and a typo in a placeholder name an exception
* rather than a wrong answer.
*/
public static function insert(Connection $conn, string $reference, int $quantity): void
{
$conn->executeStatement(
'INSERT INTO ' . self::TABLE . ' (reference, quantity) VALUES (:reference, :quantity)',
['reference' => $reference, 'quantity' => $quantity],
['reference' => ParameterType::STRING, 'quantity' => ParameterType::INTEGER],
);
}
/**
* The false-to-null bridge. fetchAssociative() returns false when the
* result is exhausted, so this is the only place in the codebase that has
* to know that, and callers can use ?-> and ?? on the result.
*
* @return array<string, mixed>|null
*/
public static function firstRow(Result $result): ?array
{
$row = $result->fetchAssociative();
return $row === false ? null : $row;
}
/** @return array<string, mixed>|null */
public static function findByReference(Connection $conn, string $reference): ?array
{
return self::firstRow($conn->executeQuery(
'SELECT id, reference, quantity FROM ' . self::TABLE . ' WHERE reference = :reference',
['reference' => $reference],
['reference' => ParameterType::STRING],
));
}
/**
* The correct IN clause: createNamedParameter puts a single :dcValueN into
* the SQL, and ArrayParameterType is what makes ExpandArrayParameters turn
* that one placeholder into one `?` per element at execute time. getSQL()
* still shows the unexpanded form; the expansion happens inside
* Connection::executeQuery.
*
* @param list<int> $ids
*
* @return list<string>
*/
public static function referencesForIds(Connection $conn, array $ids): array
{
$qb = $conn->createQueryBuilder();
$qb->select('reference')
->from(self::TABLE)
->where($qb->expr()->in('id', $qb->createNamedParameter($ids, ArrayParameterType::INTEGER)))
->orderBy('id');
return $qb->executeQuery()->fetchFirstColumn();
}
/**
* Kept because it is what people write and it is not a query builder at
* all: expr()->in() implodes whatever array it is handed straight into the
* SQL string. With ints it returns the right rows, which is exactly why it
* survives review.
*
* @param list<int|string> $values
*
* @return list<int>
*/
public static function idsForInlinedIn(Connection $conn, string $column, array $values): array
{
$qb = $conn->createQueryBuilder();
$qb->select('id')->from(self::TABLE)->where($qb->expr()->in($column, $values))->orderBy('id');
return $qb->executeQuery()->fetchFirstColumn();
}
/**
* Doctrine type names as the database reports them back.
*
* @return array<string, string>
*/
public static function introspectedTypeNames(Connection $conn): array
{
return self::typeNames($conn->createSchemaManager()->introspectTable(self::TABLE));
}
/**
* Doctrine type names as they were declared.
*
* @return array<string, string>
*/
public static function typeNames(Table $table): array
{
$names = [];
foreach ($table->getColumns() as $column) {
// Type::getName() is gone in DBAL 4; lookupName() asks the registry.
$names[$column->getName()] = Type::lookupName($column->getType());
}
return $names;
}
}
<?php
use Csx\Ledger;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\ArrayParameters\Exception\MissingNamedParameter;
use Doctrine\DBAL\ArrayParameters\Exception\MissingPositionalParameter;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
use PHPUnit\Framework\TestCase;
final class LedgerTest extends TestCase
{
private Connection $conn;
protected function setUp(): void
{
$this->conn = Ledger::connect();
Ledger::migrate($this->conn);
Ledger::insert($this->conn, 'A-1', 10);
Ledger::insert($this->conn, 'B-2', 20);
Ledger::insert($this->conn, 'C-3', 30);
}
/**
* Runs $fn with PHP diagnostics captured instead of raised, so the test can
* assert on a warning that would otherwise be invisible.
*
* @return array{0: list<string>, 1: mixed}
*/
private function capturingDiagnostics(callable $fn): array
{
$seen = [];
set_error_handler(static function (int $number, string $message) use (&$seen): bool {
$seen[] = $message;
return true;
});
try {
$value = $fn();
} finally {
restore_error_handler();
}
return [$seen, $value];
}
public function testPositionalParametersAreBoundInInsertionOrderAndTheKeysAreIgnored(): void
{
$sql = 'SELECT reference FROM orders WHERE id = ? AND quantity = ?';
// The same two key/value pairs, assembled in two different orders. To
// PHP these arrays are equal; to DBAL they are different queries.
$built = [];
$built[0] = 2;
$built[1] = 20;
$reordered = [];
$reordered[1] = 20;
$reordered[0] = 2;
// PHP's == ignores key order, so the two arrays are equal by the
// comparison most code would use; only === and array_keys() can see the
// difference, and neither is something you would think to check.
$this->assertTrue($built == $reordered);
$this->assertFalse($built === $reordered);
$this->assertSame([0, 1], array_keys($built));
$this->assertSame([1, 0], array_keys($reordered));
$this->assertSame('B-2', $this->conn->executeQuery($sql, $built)->fetchOne());
// Measured: no row, no warning, no exception. Connection::bindParameters
// walks the array in insertion order and binds to 1, 2, 3 — it never
// reads a key. Here that means id = 20 AND quantity = 2.
$this->assertFalse($this->conn->executeQuery($sql, $reordered)->fetchOne());
// ksort is enough to fix it, which is also the proof that order, not
// content, was the difference.
ksort($reordered);
$this->assertSame('B-2', $this->conn->executeQuery($sql, $reordered)->fetchOne());
// Keys being ignored is also why these two "work". A 1-based array is
// not being matched to PDO's 1-based positions; nothing is matching.
$this->assertSame('B-2', $this->conn->executeQuery($sql, [1 => 2, 2 => 20])->fetchOne());
$this->assertSame('B-2', $this->conn->executeQuery($sql, [9 => 2, 4 => 20])->fetchOne());
// Named parameters go through the SQL parser and are resolved by name,
// so the order they were set in cannot matter.
$named = 'SELECT reference FROM orders WHERE id = :id AND quantity = :quantity';
$this->assertSame('B-2', $this->conn->executeQuery($named, ['quantity' => 20, 'id' => 2])->fetchOne());
$this->assertSame('B-2', $this->conn->executeQuery($named, ['id' => 2, 'quantity' => 20])->fetchOne());
}
public function testMixingNamedAndPositionalPlaceholdersWorksAndTheFirstArrayKeyDecides(): void
{
// The 4.4 manual says "You cannot mix the positional and the named
// approach." Measured on 4.4.4, you can — and that is worse than the
// documented refusal, because whether it is handled properly depends on
// something invisible at the call site.
//
// Connection::expandArrayParameters only parses the SQL when
// is_string(key($params)) is true, or when some type is an
// ArrayParameterType. When it parses, ExpandArrayParameters rewrites
// every placeholder — named and positional alike — into `?` and
// resolves each from its own name or index.
$sql = 'SELECT reference FROM orders WHERE id = :id AND quantity = ?';
$stringKeyFirst = ['id' => 2, 0 => 20];
$this->assertSame('B-2', $this->conn->executeQuery($sql, $stringKeyFirst)->fetchOne());
// Identical values, identical SQL, the array assembled the other way
// round. The parser never runs, so the values are bound by insertion
// order against SQLite's own placeholder numbering (:id is 1, ? is 2):
// id = 20 AND quantity = 2. No row, and nothing said so.
$intKeyFirst = [0 => 20, 'id' => 2];
$this->assertFalse($this->conn->executeQuery($sql, $intKeyFirst)->fetchOne());
// Proof that the parsing path really resolves by name rather than by
// order: here the positional placeholder comes FIRST in the SQL while
// the named value is first in the array, and the answer is still right.
$this->assertSame(
'B-2',
$this->conn->executeQuery(
'SELECT reference FROM orders WHERE quantity = ? AND id = :id',
['id' => 2, 0 => 20],
)->fetchOne(),
);
}
public function testTheSameSwitchDecidesWhetherABadParameterListIsCaught(): void
{
// Parser on: a placeholder with no value is named precisely.
try {
$this->conn->executeQuery('SELECT reference FROM orders WHERE id = :id', ['Id' => 2]);
$this->fail('a misspelled placeholder should have been rejected');
} catch (MissingNamedParameter $exception) {
$this->assertSame('Named parameter "id" does not have a bound value.', $exception->getMessage());
}
try {
$this->conn->executeQuery('SELECT reference FROM orders WHERE id = ?', ['id' => 2]);
$this->fail('a positional placeholder with a named array should have been rejected');
} catch (MissingPositionalParameter $exception) {
$this->assertSame('Positional parameter at index 0 does not have a bound value.', $exception->getMessage());
}
// Parser on: a surplus named value is simply unused.
$this->assertSame(
'B-2',
$this->conn->executeQuery(
'SELECT reference FROM orders WHERE id = :id',
['id' => 2, 'unused' => 9],
)->fetchOne(),
);
// Parser off: the same surplus is a driver error rather than a DBAL
// one, and it names nothing you wrote.
try {
$this->conn->executeQuery('SELECT reference FROM orders WHERE id = ?', [2, 99, 100]);
$this->fail('surplus positional values should have reached the driver');
} catch (DriverException $exception) {
$this->assertStringContainsString('column index out of range', $exception->getMessage());
}
}
public function testFetchAssociativeReturnsFalseNotNullWhenTheResultIsExhausted(): void
{
$result = $this->conn->executeQuery('SELECT * FROM orders WHERE id = 999');
$row = $result->fetchAssociative();
$this->assertFalse($row);
$this->assertNotNull($row);
$this->assertFalse(is_array($row));
// So the habitual null guards are dead code. ?? only fires on null.
$this->assertFalse($row ?? ['fallback' => true]);
// Which is what firstRow() is for: one place knows about the false.
$this->assertNull(Ledger::firstRow($this->conn->executeQuery('SELECT * FROM orders WHERE id = 999')));
$this->assertSame('B-2', Ledger::findByReference($this->conn, 'B-2')['reference']);
$this->assertNull(Ledger::findByReference($this->conn, 'nope'));
// A Result that did return a row returns false from then on, so the
// `while ($row = $r->fetchAssociative())` idiom does terminate.
$one = $this->conn->executeQuery('SELECT * FROM orders WHERE id = 1');
$this->assertIsArray($one->fetchAssociative());
$this->assertFalse($one->fetchAssociative());
// fetchOne is the dangerous one: false for "no row", int 0 for a row
// holding zero. They are ==, so only === separates them.
$this->conn->executeStatement("INSERT INTO orders (reference, quantity) VALUES ('D-4', 0)");
$missing = $this->conn->executeQuery('SELECT quantity FROM orders WHERE reference = ?', ['nope'])->fetchOne();
$zero = $this->conn->executeQuery('SELECT quantity FROM orders WHERE reference = ?', ['D-4'])->fetchOne();
$this->assertFalse($missing);
$this->assertSame(0, $zero);
$this->assertTrue($missing == $zero);
$this->assertFalse($missing === $zero);
// fetchAllAssociative gives an empty array instead, so the two APIs
// disagree about how "nothing" is spelled.
$this->assertSame([], $this->conn->executeQuery('SELECT * FROM orders WHERE id = 999')->fetchAllAssociative());
// And rowCount is not a row count for a SELECT on pdo_sqlite: it
// reports 0 for four rows. Count in SQL, not in PHP.
$this->assertSame(4, (int) $this->conn->executeQuery('SELECT COUNT(*) FROM orders')->fetchOne());
$this->assertSame(0, $this->conn->executeQuery('SELECT * FROM orders')->rowCount());
}
public function testTheWrongParameterTypeRewritesTheValueInsteadOfFailing(): void
{
// The write path is where it costs you. reference is VARCHAR(32); bound
// as an INTEGER the value is converted before SQLite ever sees it, and
// the stored string has lost its leading zeros. No warning, no error.
$this->conn->executeStatement(
'INSERT INTO orders (reference, quantity) VALUES (:reference, :quantity)',
['reference' => '0012', 'quantity' => 1],
['reference' => ParameterType::INTEGER, 'quantity' => ParameterType::INTEGER],
);
$this->conn->executeStatement(
'INSERT INTO orders (reference, quantity) VALUES (:reference, :quantity)',
['reference' => '0012', 'quantity' => 2],
['reference' => ParameterType::STRING, 'quantity' => ParameterType::INTEGER],
);
$stored = $this->conn->executeQuery(
'SELECT reference FROM orders WHERE quantity IN (1, 2) ORDER BY quantity',
)->fetchFirstColumn();
$this->assertSame(['12', '0012'], $stored);
// What the driver actually handed SQLite, straight from the engine.
$this->assertSame('integer', $this->conn->executeQuery('SELECT typeof(?)', ['2'], [ParameterType::INTEGER])->fetchOne());
$this->assertSame('text', $this->conn->executeQuery('SELECT typeof(?)', ['2'], [ParameterType::STRING])->fetchOne());
// Non-numeric text bound as an integer is 0, not an error.
$this->assertSame(0, $this->conn->executeQuery('SELECT ?', ['abc'], [ParameterType::INTEGER])->fetchOne());
// A float bound as an integer is truncated, not rounded and not refused.
$this->assertSame(2, $this->conn->executeQuery('SELECT ?', [2.9], [ParameterType::INTEGER])->fetchOne());
$this->assertSame('2.9', $this->conn->executeQuery('SELECT ?', [2.9], [ParameterType::STRING])->fetchOne());
// false bound as a string is the empty string, not '0'.
$this->assertSame('', $this->conn->executeQuery('SELECT ?', [false], [ParameterType::STRING])->fetchOne());
$this->assertSame(1, $this->conn->executeQuery('SELECT ?', [true], [ParameterType::INTEGER])->fetchOne());
// null outranks the declared type.
$this->assertSame('null', $this->conn->executeQuery('SELECT typeof(?)', [null], [ParameterType::INTEGER])->fetchOne());
// And this is why it survives in a codebase: on the read path SQLite
// applies the column's affinity to the comparison, so an INTEGER column
// matches whichever of the two types you declared, right or wrong.
$this->assertSame('B-2', $this->conn->executeQuery('SELECT reference FROM orders WHERE id = ?', ['2'], [ParameterType::STRING])->fetchOne());
$this->assertSame('B-2', $this->conn->executeQuery('SELECT reference FROM orders WHERE id = ?', ['2'], [ParameterType::INTEGER])->fetchOne());
// Against a text column the same mistake matches nothing, because
// 'A-1' became 0 before the comparison.
$this->assertFalse($this->conn->executeQuery('SELECT id FROM orders WHERE reference = ?', ['A-1'], [ParameterType::INTEGER])->fetchOne());
}
public function testAnInClauseNeedsCreateNamedParameterAndArrayParameterType(): void
{
// The one that works.
$this->assertSame(['A-1', 'C-3'], Ledger::referencesForIds($this->conn, [1, 3]));
// getSQL() shows one placeholder; the expansion into one `?` per
// element happens inside Connection::executeQuery, not in the builder.
$qb = $this->conn->createQueryBuilder();
$qb->select('reference')
->from('orders')
->where($qb->expr()->in('id', $qb->createNamedParameter([1, 3], ArrayParameterType::INTEGER)));
$this->assertSame('SELECT reference FROM orders WHERE id IN (:dcValue1)', $qb->getSQL());
$this->assertSame(['dcValue1' => [1, 3]], $qb->getParameters());
// An empty list becomes the literal NULL rather than a syntax error, so
// IN () never happens and the query matches nothing.
$this->assertSame([], Ledger::referencesForIds($this->conn, []));
// Failure 1: expr()->in() with raw values is string interpolation. With
// integers it returns the right rows, which is how it gets shipped.
$this->assertSame([1, 3], Ledger::idsForInlinedIn($this->conn, 'id', [1, 3]));
// With strings the same call emits `reference IN (A-1, C-3)` and SQLite
// reads the bare words as column names.
try {
Ledger::idsForInlinedIn($this->conn, 'reference', ['A-1', 'C-3']);
$this->fail('unquoted values should have been read as identifiers');
} catch (DriverException $exception) {
$this->assertStringContainsString('no such column', $exception->getMessage());
}
// Failure 2: setParameter with an array and the default STRING type.
// The array is converted to the string "Array" one level down, in
// PDO\Statement::bindValue. It is a PHP warning, not an exception, so
// in production it lands in a log nobody reads and the query returns
// nothing.
$qb = $this->conn->createQueryBuilder();
$qb->select('reference')->from('orders')->where($qb->expr()->in('id', ':ids'))->setParameter('ids', [1, 3]);
[$diagnostics, $rows] = $this->capturingDiagnostics(static fn () => $qb->executeQuery()->fetchFirstColumn());
$this->assertSame(['Array to string conversion'], $diagnostics);
$this->assertSame([], $rows);
// Failure 3: the array is there but the type is scalar. This one is
// completely silent — no diagnostic at all — because casting an array
// to int yields 1, so the query really asked for IN (1).
$qb = $this->conn->createQueryBuilder();
$qb->select('reference')
->from('orders')
->where($qb->expr()->in('id', $qb->createNamedParameter([1, 3], ParameterType::INTEGER)));
[$diagnostics, $rows] = $this->capturingDiagnostics(static fn () => $qb->executeQuery()->fetchFirstColumn());
$this->assertSame([], $diagnostics);
$this->assertSame(['A-1'], $rows);
// setParameter is also the wrong tool in a quieter way: it binds a
// value but never adds a placeholder, so a parameter whose placeholder
// is missing from the SQL is discarded without complaint.
$qb = $this->conn->createQueryBuilder();
$qb->select('reference')->from('orders')->where('id = 2')->setParameter('id', 999);
$this->assertSame('B-2', $qb->executeQuery()->fetchOne());
// ArrayParameterType works through setParameter too, and on
// Connection::executeQuery directly.
$qb = $this->conn->createQueryBuilder();
$qb->select('reference')
->from('orders')
->where($qb->expr()->in('id', ':ids'))
->setParameter('ids', [1, 3], ArrayParameterType::INTEGER);
$this->assertSame(['A-1', 'C-3'], $qb->executeQuery()->fetchFirstColumn());
$this->assertSame(
[1, 3],
$this->conn->executeQuery(
'SELECT id FROM orders WHERE reference IN (:refs) ORDER BY id',
['refs' => ['A-1', 'C-3']],
['refs' => ArrayParameterType::STRING],
)->fetchFirstColumn(),
);
// createNamedParameter allocates a fresh :dcValueN every call, so two
// parameters never collide and the counter is per builder.
$qb = $this->conn->createQueryBuilder();
$this->assertSame(':dcValue1', $qb->createNamedParameter(1));
$this->assertSame(':dcValue2', $qb->createNamedParameter(2));
$this->assertSame(['dcValue1' => 1, 'dcValue2' => 2], $qb->getParameters());
}
public function testIntrospectionLosesTheDoctrineTypeWhileTheComparatorSeesNoDifference(): void
{
$declared = Ledger::migrate(Ledger::connect());
$introspected = $this->conn->createSchemaManager()->introspectTable('orders');
// SQLite stores a declared type name, not a Doctrine type, and
// SQLitePlatform's name mapping is many-to-one. Four of these eight
// columns come back as a different Doctrine type than they went in as.
$this->assertSame([
'id' => 'integer',
'reference' => 'string',
'quantity' => 'integer',
'placed_at' => 'datetime_immutable',
'metadata' => 'json',
'tags' => 'simple_array',
'external_id' => 'guid',
'amount' => 'decimal',
], Ledger::typeNames($declared));
$this->assertSame([
'id' => 'integer',
'reference' => 'string',
'quantity' => 'integer',
'placed_at' => 'datetime',
'metadata' => 'text',
'tags' => 'text',
'external_id' => 'string',
'amount' => 'decimal',
], Ledger::introspectedTypeNames($this->conn));
// Length, precision, scale and autoincrement do survive; guid picks up
// a length and fixed flag it never had, because it was written as
// CHAR(36) and read back as one.
$this->assertSame(32, $introspected->getColumn('reference')->getLength());
$this->assertSame(10, $introspected->getColumn('amount')->getPrecision());
$this->assertSame(2, $introspected->getColumn('amount')->getScale());
$this->assertTrue($introspected->getColumn('id')->getAutoincrement());
$this->assertNull($declared->getColumn('external_id')->getLength());
$this->assertSame(36, $introspected->getColumn('external_id')->getLength());
$this->assertFalse($declared->getColumn('external_id')->getFixed());
$this->assertTrue($introspected->getColumn('external_id')->getFixed());
// The measurement that contradicts the obvious guess: this does NOT
// produce a phantom migration. The Comparator calls the two schemas
// identical and emits no ALTER, because it compares the DDL a column
// generates rather than its Doctrine type — and both sides emit the
// same DATETIME.
$platform = $this->conn->getDatabasePlatform();
$diff = $this->conn->createSchemaManager()->createComparator()->compareSchemas(
new Schema([$introspected]),
new Schema([$declared]),
);
$this->assertTrue($diff->isEmpty());
$this->assertSame([], $platform->getAlterSchemaSQL($diff));
$this->assertSame(
$platform->getColumnDeclarationSQL('placed_at', $declared->getColumn('placed_at')->toArray()),
$platform->getColumnDeclarationSQL('placed_at', $introspected->getColumn('placed_at')->toArray()),
);
// So nothing flags it, and the loss only shows up where the type is
// used to convert a value. This is what breaks a tool that introspects
// the database to build its own type map.
$raw = '2024-03-31 12:00:00';
$this->assertInstanceOf(
DateTimeImmutable::class,
$declared->getColumn('placed_at')->getType()->convertToPHPValue($raw, $platform),
);
$mutable = $introspected->getColumn('placed_at')->getType()->convertToPHPValue($raw, $platform);
$this->assertInstanceOf(DateTime::class, $mutable);
$this->assertNotInstanceOf(DateTimeImmutable::class, $mutable);
$this->assertSame(
['a' => 1],
$declared->getColumn('metadata')->getType()->convertToPHPValue('{"a":1}', $platform),
);
$this->assertSame(
'{"a":1}',
$introspected->getColumn('metadata')->getType()->convertToPHPValue('{"a":1}', $platform),
);
$this->assertSame(
['a', 'b', 'c'],
$declared->getColumn('tags')->getType()->convertToPHPValue('a,b,c', $platform),
);
$this->assertSame(
'a,b,c',
$introspected->getColumn('tags')->getType()->convertToPHPValue('a,b,c', $platform),
);
// Introspection has no fallback for a declared type it does not know.
// SQLite accepts any word as a type; DBAL refuses to read it back.
$this->conn->executeStatement('CREATE TABLE ledger_extra (v MONEY)');
try {
$this->conn->createSchemaManager()->introspectTable('ledger_extra');
$this->fail('an unmapped declared type should not have been readable');
} catch (InvalidArgumentException $exception) {
$this->assertStringContainsString('Unknown database type "money" requested', $exception->getMessage());
}
// Type::getName() is gone in DBAL 4 — lookupName() on the registry is
// the replacement, and it is a static taking the type as an argument.
$this->assertFalse(method_exists(Type::class, 'getName'));
$this->assertSame('datetime', Type::lookupName($introspected->getColumn('placed_at')->getType()));
}
}