Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

junit invalid xml #214

Closed
CalianDos opened this issue Oct 10, 2024 · 9 comments
Closed

junit invalid xml #214

CalianDos opened this issue Oct 10, 2024 · 9 comments
Assignees
Labels

Comments

@CalianDos
Copy link

New Issue

Diagnose

If you use a Composer installation, please specify:

Output of `composer show` command
$ composer show
bshaffer/oauth2-server-php         dev-develop c0c5f2c OAuth2 Server for PHP
composer/pcre                      3.1.1               PCRE wrapping library that offers type-safe preg_* replacements.
composer/xdebug-handler            3.0.3               Restarts a process without Xdebug.
datadog/php-datadogstatsd          0.4.0               This is an extremely simple PHP datadogstatsd client
evenement/evenement                3.0.2               Événement is a very simple event dispatching library for PHP
guzzlehttp/guzzle                  7.8.1               Guzzle is a PHP HTTP client library
guzzlehttp/promises                2.0.2               Guzzle promises library
guzzlehttp/psr7                    2.6.2               PSR-7 message implementation that also provides common utility methods
luracast/restler                   5.0.13              Restler is a simple and effective multi-format Web API Server framework written in PHP. Ju...
monolog/monolog                    3.5.0               Sends your logs to files, sockets, inboxes, databases and various web services
nikic/php-parser                   4.18.0              A PHP parser written in PHP
overtrue/phplint                   9.4.1               `phplint` is a tool that can speed up linting of php files by running several lint process...
pdepend/pdepend                    2.16.2              Official version of pdepend to be handled with Composer
phing/phing                        2.17.4              PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.
phploc/phploc                      7.0.2               A tool for quickly measuring the size of a PHP project.
phpmd/phpmd                        2.15.0              PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well know...
phpstan/phpstan                    1.10.59             PHPStan - PHP Static Analysis Tool
phpunit/php-file-iterator          3.0.6               FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-timer                  5.0.3               Utility class for timing
propel/propel                      2.0.0-beta3         Propel2 is an open-source Object-Relational Mapping (ORM) for PHP.
psr/cache                          3.0.0               Common interface for caching libraries
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.0.2               Common interfaces for PSR-7 HTTP message factories
psr/http-message                   2.0                 Common interface for HTTP messages
psr/log                            3.0.0               Common interface for logging libraries
ralouphie/getallheaders            3.0.3               A polyfill for getallheaders.
react/event-loop                   1.5.0               ReactPHP's core reactor event loop that libraries can use for evented I/O.
react/zmq                          0.4.0               ZeroMQ bindings for React.
sebastian/cli-parser               1.0.2               Library for parsing CLI options
sebastian/version                  3.0.2               Library that helps with managing the version number of Git-hosted PHP projects
symfony/cache                      7.0.4               Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts            3.4.0               Generic abstractions related to caching
symfony/config                     6.4.4               Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                    6.4.4               Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection       7.0.4               Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts      3.4.0               A generic function and convention to trigger deprecation notices
symfony/event-dispatcher           7.0.3               Provides tools that allow your application components to communicate with each other by di...
symfony/event-dispatcher-contracts 3.4.0               Generic abstractions related to dispatching event
symfony/filesystem                 6.4.3               Provides basic utilities for the filesystem
symfony/finder                     6.4.0               Finds files and directories via an intuitive fluent interface
symfony/options-resolver           7.0.0               Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype             1.29.0              Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme     1.29.0              Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer   1.29.0              Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          1.29.0              Symfony polyfill for the Mbstring extension
symfony/polyfill-php80             1.29.0              Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php83             1.29.0              Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
symfony/process                    7.0.4               Executes commands in sub-processes
symfony/service-contracts          3.4.1               Generic abstractions related to writing services
symfony/string                     7.0.4               Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and gra...
symfony/translation                6.4.4               Provides tools to internationalize your application
symfony/translation-contracts      3.4.1               Generic abstractions related to translation
symfony/validator                  6.4.4               Provides tools to validate values
symfony/var-exporter               7.0.4               Allows exporting any serializable PHP data structure to plain PHP code
symfony/yaml                       6.4.3               Loads and dumps YAML files
theseer/directoryscanner           1.3.3               A recursive directory scanner and filter
theseer/fdomdocument               1.6.7               The classes contained within this repository extend the standard DOM to use exceptions at ...
theseer/phpdox                     dev-master 1aa70b1  A fast Documentation generator for PHP Code using standard technology (SRC, DOCBLOCK, XML ...

If you use Docker image of PHP Lint, please specify:

n/a

If you use PHAR version of PHP Lint, please specify:
n/a

Summary

Running phplint --no-progress --output=phplint.xml --format=junit and it generates invalid xml.
.phplint.yml:

path: /var/www/html/
warning: true
exclude:
  - build/
  - cache/
  - db/
  - vendor/
extensions:
  - php

Expected behaviour

Proper xml output

Actual behaviour

Note the missing </error> close tag

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite name="PHP Linter 9.4.1" timestamp="2024-10-10T21:14:29+0000" time="&lt; 1 sec" tests="1" errors="1">
        <testcase errors="1" failures="0">
            <error type="Error" message=" Optional parameter $log declared before required parameter $user_access_token is implicitly treated as a required parameter in line 27">/var/www/html/src/libraries/core/CoreServiceCas.php
        </testcase>
    </testsuite>
</testsuites>
@llaville llaville self-assigned this Oct 11, 2024
@llaville llaville added the bug label Oct 11, 2024
@llaville
Copy link
Collaborator

This issue exists since a long time ;-)

By compromise contract

phplint_supported_versions

I'll fixed all versions impacted :

  • 9.1.x
  • 9.2.x
  • 9.3.x
  • 9.4.x
  • 9.5.x

Caution

As PHP 8.1 will stop to be actively supported on November 2024, this is probably the last time, I'll actively support versions 9.1, 9.2, 9.3, and 9.4.

On November 2024, I'll marked them as End-Of-Life (cc /@overtrue)

@llaville
Copy link
Collaborator

Reason of this issue, came from usage of symfony/console output formatter that declared an error style.
See : https://github.com/symfony/console/blob/7.1/Formatter/OutputFormatter.php#L74

And the format action, see https://github.com/symfony/console/blob/7.1/Formatter/OutputFormatter.php#L115-L166
consider it as a style and not an html tag !

Fix is pretty easy :

$this->write($document->saveXML(), false, self::OUTPUT_RAW);

llaville added a commit that referenced this issue Oct 11, 2024
llaville added a commit that referenced this issue Oct 11, 2024
@llaville
Copy link
Collaborator

@CalianDos Version 9.5.3 has just been released with the fix.

Please consider to use it, unless you are on PHP 8.1 platform. But be careful, for previous reasons, other 9.x family versions (that should be fixed soon) will end of active support very soon (less than a month).

llaville added a commit that referenced this issue Oct 11, 2024
@llaville
Copy link
Collaborator

Version 9.4.2 has just been released. PHP 8.1 compatible !

@CalianDos
Copy link
Author

Hi! Thanks very much. Confirmed works as expected with 9.5.3.

Unfortunately gitlab's ci doesn't seems to work great with the report so we've just gone console output in the end.

This is the view in the pipeline's tests display. Strange that it doesn't even get the testsuite name. And it also ignores the message attribute.
image
Clicking details just shows the file path
image
We'll engage with their support eventually, can't seem to find any description of what they consider to be valid junit.

llaville added a commit that referenced this issue Oct 12, 2024
@llaville
Copy link
Collaborator

As promised, backported fix to version 9.3.2 now available

llaville added a commit that referenced this issue Oct 12, 2024
@llaville
Copy link
Collaborator

As promised, backported fix to version 9.2.1 now available

llaville added a commit that referenced this issue Oct 12, 2024
@llaville
Copy link
Collaborator

As promised, backported fix to version 9.1.3 now available

@llaville
Copy link
Collaborator

Now fix was applied on all branches that we still supported versions (9.1, 9.2, 9.3, 9.4 and 9.5), I'll close this issue report !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants