Skip to content

PHP 8.5 Type Casting Warning in PageFinder #2179

@skeltern

Description

@skeltern

I see sometimes PHP warnings in frontend and backend when debug mode is enabled.

Warning: The float-string "6e85bf91c4041edc" is not representable as an int, cast occurred in /www/htdocs/foo/domain.tld/wire/core PageFinder.php on line 1839

The reason is likely due to a PHP 8.5 update related to type casting for integers. I have XXH64 hash values stored in many fields (as text/string). Most API ->find() requests work fine, but some trigger this warning, depending on the hash string.

For example, searching for '8eb9e52d71d3cd94' works without issues:

`var_dump((int)` '8eb9e52d71d3cd94');
$result = wire('pages')->findOne('field=8eb9e52d71d3cd94');

Following hash always results in a warning:

var_dump((int) '6e85bf91c4041edc');
$result = wire('pages')->findOne('field=6e85bf91c4041edc');

The reason is that PHP 8.5 enforces stricter type casting rules. This could lead to unexpected results when converting strings to int. A code update in PageFinder might resolve this issue.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions