Skip to content

Test runner crashes with Timer::start() has to be called before Timer::stop() #6446

@no-simpler

Description

@no-simpler
Q A
PHPUnit version 12.5.3
PHP version 8.4.15
Installation Method Composer

Summary

Symfony 7.4 project.

Happy path: containerized php:8.4-fpm-bullseye
$ docker compose exec app vendor/bin/phpunit --check-php-configuration
PHPUnit 12.5.3 by Sebastian Bergmann and contributors.

Checking whether PHP is configured according to https://docs.phpunit.de/en/12.5/installation.html#configuring-php-for-development

display_errors = On             ... not ok ()
display_startup_errors = On     ... not ok ()
error_reporting = -1            ... ok
xdebug.show_exception_trace = 0 ... ok
zend.assertions = 1             ... not ok (-1)
assert.exception = 1            ... ok
memory_limit = -1               ... not ok (1024M)

$ docker compose exec app vendor/bin/phpunit
PHPUnit 12.5.3 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.11 with PCOV 1.0.12
Configuration: /app/phpunit.dist.xml

...............................................................  63 / 140 ( 45%)
............................................................... 126 / 140 ( 90%)
..............                                                  140 / 140 (100%)

Time: 00:02.055, Memory: 34.00 MB

OK (140 tests, 279 assertions)

Generating code coverage report in Clover XML format ... done [00:00.005]

Generating code coverage report in HTML format ... done [00:00.088]


Code Coverage Report Summary:
  Classes: 100.00% (18/18)
  Methods: 100.00% (70/70)
  Lines:   100.00% (281/281)
Sad path: System-wide PHP 8.4 (Homebrew) on macOS 26.1
$ vendor/bin/phpunit --check-php-configuration
PHPUnit 12.5.3 by Sebastian Bergmann and contributors.

Checking whether PHP is configured according to https://docs.phpunit.de/en/12.5/installation.html#configuring-php-for-development

display_errors = On             ... ok
display_startup_errors = On     ... ok
error_reporting = -1            ... ok
xdebug.show_exception_trace = 0 ... ok
zend.assertions = 1             ... ok
assert.exception = 1            ... ok
memory_limit = -1               ... ok

$ vendor/bin/phpunit
PHPUnit 12.5.3 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.15 with PCOV 1.0.12
Configuration: /Users/username/project-path/phpunit.dist.xml

...........................R

An error occurred inside PHPUnit.

Message:  Timer::start() has to be called before Timer::stop()
Location: /Users/username/project-path/vendor/phpunit/php-timer/src/Timer.php:33

#0 /Users/username/project-path/vendor/phpunit/phpunit/src/Runner/CodeCoverage.php(216): SebastianBergmann\Timer\Timer->stop()
#1 /Users/username/project-path/vendor/phpunit/phpunit/src/Framework/TestRunner/TestRunner.php(158): PHPUnit\Runner\CodeCoverage->stop(true, Object(SebastianBergmann\CodeCoverage\Test\Target\TargetCollection), Object(SebastianBergmann\CodeCoverage\Test\Target\TargetCollection))
#2 /Users/username/project-path/vendor/phpunit/phpunit/src/Framework/TestCase.php(359): PHPUnit\Framework\TestRunner->run(Object(App\Tests\Plumbing\Security\Authenticator\BearerTokenAuthenticatorTest))
#3 /Users/username/project-path/vendor/phpunit/phpunit/src/Framework/TestSuite.php(374): PHPUnit\Framework\TestCase->run()
#4 /Users/username/project-path/vendor/phpunit/phpunit/src/Framework/TestSuite.php(374): PHPUnit\Framework\TestSuite->run()
#5 /Users/username/project-path/vendor/phpunit/phpunit/src/Framework/TestSuite.php(374): PHPUnit\Framework\TestSuite->run()
#6 /Users/username/project-path/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(64): PHPUnit\Framework\TestSuite->run()
#7 /Users/username/project-path/vendor/phpunit/phpunit/src/TextUI/Application.php(229): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\TextUI\Configuration\Configuration), Object(PHPUnit\Runner\ResultCache\DefaultResultCache), Object(PHPUnit\Framework\TestSuite))
#8 /Users/username/project-path/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#9 /Users/username/project-path/vendor/bin/phpunit(122): include('/Users/username/...')
#10 {main}

composer info | sort

amphp/amp                                3.1.1    A non-blocking concurrency framework for PHP applications.
amphp/byte-stream                        2.1.2    A stream abstraction to make working with non-blocking I/O simple.
amphp/cache                              2.0.1    A fiber-aware cache API based on Amp and Revolt.
amphp/dns                                2.4.0    Async DNS resolution for Amp.
amphp/parallel                           2.3.3    Parallel processing component for Amp.
amphp/parser                             1.1.1    A generator parser to make streaming parsers simple.
amphp/pipeline                           1.2.3    Asynchronous iterators and operators.
amphp/process                            2.0.3    A fiber-aware process manager based on Amp and Revolt.
amphp/serialization                      1.0.0    Serialization tools for IPC and data storage in PHP.
amphp/socket                             2.3.1    Non-blocking socket connection / server implementations based on Amp and Revolt.
amphp/sync                               2.3.0    Non-blocking synchronization primitives for PHP based on Amp and Revolt.
brick/math                               0.14.1   Arbitrary-precision arithmetic library
clue/ndjson-react                        1.3.0    Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.
composer/ca-bundle                       1.5.10   Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
composer/class-map-generator             1.7.0    Utilities to scan PHP code and generate class maps.
composer/composer                        2.9.2    Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack...
composer/metadata-minifier               1.0.0    Small utility library that handles metadata minification and expansion.
composer/pcre                            3.3.2    PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                          3.4.4    Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses                   1.5.9    SPDX licenses list and validation library.
composer/xdebug-handler                  3.0.5    Restarts a process without Xdebug.
dama/doctrine-test-bundle                8.4.1    Symfony bundle to isolate doctrine database tests and improve test performance
danog/advanced-json-rpc                  3.2.2    A more advanced JSONRPC implementation
daverandom/libdns                        2.1.0    DNS protocol implementation written in pure PHP
dnoegel/php-xdg-base-dir                 0.1.1    implementation of xdg base directory specification for php
doctrine/collections                     2.4.0    PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/data-fixtures                   2.2.0    Data Fixtures for all Doctrine Object Managers
doctrine/dbal                            4.4.1    Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations                    1.1.5    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecatio...
doctrine/doctrine-bundle                 3.1.0    Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle        4.3.1    Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle      3.7.0    Symfony DoctrineMigrationsBundle
doctrine/event-manager                   2.0.1    The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine proj...
doctrine/inflector                       2.1.0    PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase a...
doctrine/instantiator                    2.0.0    A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                           3.0.1    PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                      3.9.5    PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) f...
doctrine/orm                             3.5.8    Object-Relational-Mapper for PHP
doctrine/persistence                     4.1.1    The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine obj...
doctrine/sql-formatter                   1.5.3    a PHP SQL highlighting library
evenement/evenement                      3.0.2    Événement is a very simple event dispatching library for PHP
felixfbecker/language-server-protocol    1.5.3    PHP classes for the Language Server Protocol
fidry/cpu-core-counter                   1.3.0    Tiny utility to get the number of CPU cores.
friendsofphp/php-cs-fixer                3.91.3   A tool to automatically fix PHP code style
gitonomy/gitlib                          1.5.0    Library for accessing git
guzzlehttp/psr7                          2.8.0    PSR-7 message implementation that also provides common utility methods
jean85/pretty-package-versions           2.1.1    A library to get pretty versions strings of installed dependencies
justinrainbow/json-schema                6.6.3    A library to validate a json schema.
kelunik/certificate                      1.1.3    Access certificate details and transform between different formats.
laravel/serializable-closure             2.0.7    Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
lastguest/murmurhash                     2.1.1    MurmurHash3 Hash
league/uri                               7.7.0    URI manipulation library
league/uri-interfaces                    7.7.0    Common tools for parsing and resolving RFC3987/RFC3986 URI
marc-mabe/php-enum                       4.7.2    Simple and fast implementation of enumerations with native PHP
masterminds/html5                        2.10.0   An HTML5 parser and serializer.
monolog/monolog                          3.9.0    Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                        1.13.4   Create deep copies (clones) of your objects
netresearch/jsonmapper                   5.0.0    Map nested JSON structures onto PHP classes
nikic/php-parser                         5.7.0    A PHP parser written in PHP
nyholm/psr7                              1.8.2    A fast PHP7 implementation of PSR-7
ondram/ci-detector                       4.2.0    Detect continuous integration environment and provide unified access to properties of current build
phar-io/manifest                         2.0.4    Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                          3.2.1    Library for handling version information and constraints
php-http/discovery                       1.20.0   Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations
phpdocumentor/reflection-common          2.2.0    Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock        5.6.5    With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve informati...
phpdocumentor/type-resolver              1.12.0   A PSR-5 based resolver of Class names, Types and Structural Element Names
phpro/grumphp                            2.18.0   A composer plugin that enables source code quality checks.
phpstan/extension-installer              1.4.3    Composer plugin for automatic installation of PHPStan extensions
phpstan/phpdoc-parser                    2.3.0    PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan                          2.1.33   PHPStan - PHP Static Analysis Tool
phpstan/phpstan-doctrine                 2.0.12   Doctrine extensions for PHPStan
phpstan/phpstan-phpunit                  2.0.10   PHPUnit extensions and rules for PHPStan
phpstan/phpstan-strict-rules             2.0.7    Extra strict and opinionated rules for PHPStan
phpstan/phpstan-symfony                  2.0.9    Symfony Framework extensions and rules for PHPStan
phpstan/phpstan-webmozart-assert         2.0.0    PHPStan webmozart/assert extension
phpunit/php-code-coverage                12.5.1   Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator                6.0.0    FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                      6.0.0    Invoke callables with a timeout
phpunit/php-text-template                5.0.0    Simple template engine.
phpunit/php-timer                        8.0.0    Utility class for timing
phpunit/phpunit                          12.5.3   The PHP Unit Testing framework.
psalm/plugin-phpunit                     0.19.5   Psalm plugin for PHPUnit
psalm/plugin-symfony                     5.2.7    Psalm Plugin for Symfony
psr/cache                                3.0.0    Common interface for caching libraries
psr/clock                                1.0.0    Common interface for reading the clock.
psr/container                            2.0.2    Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                     1.0.0    Standard interfaces for event handling.
psr/http-client                          1.0.3    Common interface for HTTP clients
psr/http-factory                         1.1.0    PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message                         2.0      Common interface for HTTP messages
psr/link                                 2.0.1    Common interfaces for HTTP links
psr/log                                  3.0.2    Common interface for logging libraries
psr/simple-cache                         3.0.0    Common interfaces for simple caching
ralouphie/getallheaders                  3.0.3    A polyfill for getallheaders.
ramsey/collection                        2.1.1    A PHP library for representing and manipulating collections.
ramsey/uuid                              4.9.1    A PHP library for generating and working with universally unique identifiers (UUIDs).
react/cache                              1.2.0    Async, Promise-based cache interface for ReactPHP
react/child-process                      0.6.6    Event-driven library for executing child processes with ReactPHP.
react/dns                                1.14.0   Async DNS resolver for ReactPHP
react/event-loop                         1.6.0    ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/promise                            3.3.0    A lightweight implementation of CommonJS Promises/A for PHP
react/socket                             1.17.0   Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP
react/stream                             1.4.0    Event-driven readable and writable streams for non-blocking I/O in ReactPHP
revolt/event-loop                        1.0.8    Rock-solid event loop for concurrent PHP applications.
sebastian/cli-parser                     4.2.0    Library for parsing CLI options
sebastian/comparator                     7.1.3    Provides the functionality to compare PHP values for equality
sebastian/complexity                     5.0.0    Library for calculating the complexity of PHP code units
sebastian/diff                           7.0.0    Diff implementation
sebastian/environment                    8.0.3    Provides functionality to handle HHVM/PHP environments
sebastian/exporter                       7.0.2    Provides the functionality to export PHP variables for visualization
sebastian/global-state                   8.0.2    Snapshotting of global state
sebastian/lines-of-code                  4.0.0    Library for counting the lines of code in PHP source code
sebastian/object-enumerator              7.0.0    Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector               5.0.0    Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context              7.0.1    Provides functionality to recursively process PHP variables
sebastian/type                           6.0.3    Collection of value objects that represent the types of the PHP type system
sebastian/version                        6.0.0    Library that helps with managing the version number of Git-hosted PHP projects
seld/jsonlint                            1.11.0   JSON Linter
seld/phar-utils                          1.2.1    PHAR file format utilities, for when PHP phars you up
seld/signal-handler                      2.0.2    Simple unix signal handler that silently fails where signals are not supported for easy cross-platform development
sensiolabs/minify-bundle                 1.2.0    Assets Minifier (CSS, JS) for Symfony & Minify integration in Asset Mapper
sensiolabs/typescript-bundle             0.2.2    TypeScript support for Symfony + AssetMapper
sentry/sentry                            4.19.1   PHP SDK for Sentry (http://sentry.io)
sentry/sentry-symfony                    5.8.2    Symfony integration for Sentry (http://getsentry.com)
spatie/array-to-xml                      3.4.3    Convert an array to xml
staabm/side-effects-detector             1.0.5    A static analysis tool to detect side effects in PHP code
symfony/amqp-messenger                   7.4.0    Symfony AMQP extension Messenger Bridge
symfony/asset                            7.4.0    Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/asset-mapper                     7.4.0    Maps directories of assets & makes them available in a public directory with versioned filenames.
symfony/browser-kit                      7.4.0    Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programm...
symfony/cache                            7.4.1    Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts                  3.6.0    Generic abstractions related to caching
symfony/clock                            7.4.0    Decouples applications from the system clock
symfony/config                           7.4.1    Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                          7.4.1    Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                     7.4.0    Converts CSS selectors to XPath expressions
symfony/dependency-injection             7.4.2    Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts            3.6.0    A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge                  7.4.1    Provides integration for Doctrine with various Symfony components
symfony/doctrine-messenger               7.4.1    Symfony Doctrine Messenger Bridge
symfony/dom-crawler                      7.4.1    Eases DOM navigation for HTML and XML documents
symfony/dotenv                           7.4.0    Registers environment variables from a .env file
symfony/error-handler                    7.4.0    Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher                 7.4.0    Provides tools that allow your application components to communicate with each other by dispatching events and l...
symfony/event-dispatcher-contracts       3.6.0    Generic abstractions related to dispatching event
symfony/expression-language              7.4.0    Provides an engine that can compile and evaluate expressions
symfony/filesystem                       7.4.0    Provides basic utilities for the filesystem
symfony/finder                           7.4.0    Finds files and directories via an intuitive fluent interface
symfony/flex                             2.10.0   Composer plugin for Symfony
symfony/framework-bundle                 7.4.1    Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client                      7.4.1    Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts            3.6.0    Generic abstractions related to HTTP clients
symfony/http-foundation                  7.4.1    Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                      7.4.2    Provides a structured process for converting a Request into a Response
symfony/intl                             7.4.0    Provides access to the localization data of the ICU library
symfony/maker-bundle                     1.65.1   Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about...
symfony/messenger                        7.4.0    Helps applications send and receive messages to/from other applications or via message queues
symfony/monolog-bridge                   7.4.0    Provides integration for Monolog with various Symfony components
symfony/monolog-bundle                   4.0.1    Symfony MonologBundle
symfony/options-resolver                 7.4.0    Provides an improved replacement for the array_replace PHP function
symfony/password-hasher                  7.4.0    Provides password hashing utilities
symfony/polyfill-intl-grapheme           1.33.0   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer         1.33.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                1.33.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-php85                   1.33.0   Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions
symfony/process                          7.4.0    Executes commands in sub-processes
symfony/property-access                  7.4.0    Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info                    7.4.1    Extracts information about PHP class' properties using metadata of popular sources
symfony/psr-http-message-bridge          7.4.0    PSR HTTP message bridge
symfony/routing                          7.4.0    Maps an HTTP request to a set of configuration variables
symfony/runtime                          7.4.1    Enables decoupling PHP applications from global state
symfony/security-bundle                  7.4.0    Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core                    7.4.0    Symfony Security Component - Core Library
symfony/security-csrf                    7.4.0    Symfony Security Component - CSRF Library
symfony/security-http                    7.4.1    Symfony Security Component - HTTP Integration
symfony/serializer                       7.4.2    Handles serializing and deserializing data structures, including object graphs, into array structures or other f...
symfony/service-contracts                3.6.1    Generic abstractions related to writing services
symfony/stimulus-bundle                  2.31.0   Integration with your Symfony app & Stimulus!
symfony/stopwatch                        7.4.0    Provides a way to profile code
symfony/string                           7.4.0    Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a un...
symfony/translation-contracts            3.6.1    Generic abstractions related to translation
symfony/twig-bridge                      7.4.1    Provides integration for Twig with various Symfony components
symfony/twig-bundle                      7.4.0    Provides a tight integration of Twig into the Symfony full-stack framework
symfony/type-info                        7.4.1    Extracts PHP types information.
symfony/ux-icons                         2.31.0   Renders local and remote SVG icons in your Twig templates.
symfony/ux-turbo                         2.31.0   Hotwire Turbo integration for Symfony
symfony/ux-twig-component                2.31.0   Twig components for Symfony
symfony/var-dumper                       7.4.0    Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                     7.4.0    Allows exporting any serializable PHP data structure to plain PHP code
symfony/web-link                         7.4.0    Manages links between resources
symfony/web-profiler-bundle              7.4.0    Provides a development tool that gives detailed information about the execution of any request
symfony/yaml                             7.4.1    Loads and dumps YAML files
theseer/tokenizer                        2.0.1    A small library for converting tokenized PHP source code into XML and potentially other formats
twig/extra-bundle                        3.22.1   A Symfony bundle for extra Twig extensions
twig/intl-extra                          3.22.1   A Twig extension for Intl
twig/twig                                3.22.1   Twig, the flexible, fast, and secure template language for PHP
unleash/client                           2.9.184 
unleash/symfony-client-bundle            0.12.182
vimeo/psalm                              6.14.2   A static analysis tool for finding errors in PHP applications
vincentlanglet/twig-cs-fixer             3.11.0   A tool to automatically fix Twig code style
webmozart/assert                         1.12.1   Assertions to validate method input/output with nice error messages.
weirdan/doctrine-psalm-plugin            2.10.0   Stubs to let Psalm understand Doctrine better

Metadata

Metadata

Labels

feature/code-coverageIssues related to code coverage (but not php-code-coverage)type/bugSomething is broken

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions