Skip to content

Conversation

@aaa2000
Copy link
Contributor

@aaa2000 aaa2000 commented Dec 4, 2025

Q A
Branch main
License MIT

This PR updates the GitHub Actions workflow to use the latest stable PHP version, 8.5, in the CI pipeline.

… is deprecated since 8.5, as it has no effect

As of PHP 8.1.0, calling this method has no effect; all properties are accessible by default.

@see https://www.php.net/manual/en/reflectionproperty.setaccessible.php
@see https://wiki.php.net/rfc/deprecations_php_8_5#extreflection_deprecations
ArrayObject::__construct(): Using an object as a backing array for ArrayObject is deprecated, as it allows violating class constraints and invariants
Method SplObjectStorage::contains() is deprecated since 8.5, use method SplObjectStorage::offsetExists() instead
Method SplObjectStorage::detach() is deprecated since 8.5, use method SplObjectStorage::offsetUnset() instead
@aaa2000
Copy link
Contributor Author

aaa2000 commented Dec 5, 2025

The error of the "PHPUnit + Behat (PHP 8.5) (MongoDB)" job is already present on the main branch.

The errors of others behat jobs appear to be related to the following deprecation https://wiki.php.net/rfc/warnings-php-8-5#coercing_nan_to_other_types

<response>
	<title>An error occurred</title>
	<detail>Warning: unexpected NAN value was coerced to string in
		/code/vendor/doctrine/dbal/src/Driver/PDO/Statement.php line 26
	</detail>
	<status>500</status>
	<type>/errors/500</type>
	<trace>
		<function>handleError</function>
		<class>Behat\Testwork\Call\Handler\RuntimeCallHandler</class>
		<type><![CDATA[->]]></type>
	</trace>
	<trace>
		<file>/code/vendor/doctrine/dbal/src/Driver/PDO/Statement.php</file>
		<line>26</line>
		<function>bindValue</function>
		<class>PDOStatement</class>
		<type><![CDATA[->]]></type>
	</trace>

When the value is NaN, INF, or -INF, PDO::bindValue with PDO::PARAM_STR appears to convert to a string and throw the warning Warning: unexpected NAN value was coerced to string

Note: These values ​​are not compatible with SQLite, the value is 0, unlike postgres.

<?xml version="1.0"?><response><id>2</id><myFloatField>NAN</myFloatField></response>
<?xml version="1.0"?><response><id>3</id><myFloatField>INF</myFloatField></response>
`<?xml version="1.0"?>\n<response><id>4</id><myFloatField>-INF</myFloatField></response>

no idea how to fix it... Should the test be ignored in PHP 8.5?

matrix:
php:
- '8.3'
- '8.5'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

php-cs-fixer doesn't support 8.5 yet can you lower to 8.4 maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP 8.5 officially supported in version v3.91.0 https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/tag/v3.91.0

Copy link
Member

@soyuka soyuka Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but their recommendation is:

You are running PHP CS Fixer on PHP 8.5.0, but the minimum PHP version supported by your project in composer.json is PHP 8.2. Executing PHP CS Fixer on newer PHP versions may introduce syntax or features not yet available in PHP 8.2, which could cause issues under that version. It is recommended to run PHP CS Fixer on PHP 8.2, to fit your project specifics.

Unsure about what we should do...

@soyuka
Copy link
Member

soyuka commented Dec 7, 2025

This failure is probably related to the changes:


--- Failed steps:

001 Example: | NaN   |                            # features/xml/deserialization.feature:74
      Then the response status code should be 201 # features/xml/deserialization.feature:68
        Current response status code is 500, but 201 expected. (Behat\Mink\Exception\ExpectationException)

839 scenarios (837 passed, 1 failed, 1 undefined)
5481 steps (5470 passed, 1 failed, 1 undefined, 9 skipped)
6m38.62s (324.02Mb)

Add a Then print last JSON response in there to know what's wrong. There are instructions in CONTRIBUTING.md if you need the commands to run the tests.

@aaa2000
Copy link
Contributor Author

aaa2000 commented Dec 7, 2025

The error <response><title>An error occurred</title><detail>Warning: unexpected NAN value was coerced to string in /code/vendor/doctrine/dbal/src/Driver/PDO/Statement.php line 26</detail> was a dump of the response. I think it's the same thing as step `Then print last JSON response.

With PHP 8.5 and PDO, I have

docker run --rm php:8.5-cli php -r '
$pdo = new PDO("sqlite::memory:");
$stmt = $pdo->prepare("
    WITH dummy(value) AS (VALUES ('1'), ('2'))
    SELECT * FROM dummy WHERE value = :value
");
$stmt->bindValue(":value", NAN, PDO::PARAM_STR);
$stmt->execute();
var_dump($stmt->fetchAll());
'

Warning: unexpected NAN value was coerced to string in Command line code on line 7
array(0) {
}

I will investigate further

@soyuka
Copy link
Member

soyuka commented Dec 11, 2025

Interesting this means that the issue is inside Symfony transformation? I'm not even sure why we support XML to be honest xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants