Skip to content

Conversation

@israelsaba
Copy link

Resolves issue: 55812
After PHP 8.1, it emmits a warning when coercing non-numeric values into numeric. This PR solves the warning A non-numeric value encountered at /var/www/html/apps/dav/lib/Files/FileSearchBackend.php#485 that floods the users affect by this issue.

@israelsaba israelsaba marked this pull request as ready for review November 25, 2025 01:44
@israelsaba israelsaba requested a review from a team as a code owner November 25, 2025 01:44
@israelsaba israelsaba requested review from Altahrim, come-nc, salmart-dev and yemkareems and removed request for a team November 25, 2025 01:44
@israelsaba israelsaba marked this pull request as draft November 25, 2025 01:45
@israelsaba israelsaba marked this pull request as ready for review November 25, 2025 01:48
@israelsaba israelsaba changed the title ix(webdav_search):prevents non-numeric coerce as numeric warning fix(webdav_search):prevents non-numeric coerce as numeric warning Nov 25, 2025
Comment on lines +485 to +489
if (is_int($value) || is_float($value)) {
return 0 + $value;
}
$v = filter_var($value, FILTER_VALIDATE_FLOAT);
return $v === false ? 0 : $v;
Copy link
Contributor

Choose a reason for hiding this comment

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

That means bad values are now silently cast to 0? I’m not sure if it’s a good idea. It would be better to start by fixing the dashboard widget that is causing the logging?

I would prefer an is_numeric test and at least logging (debug or even info) that there’s an issue, if possible with more info than the PHP warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree - if its an invalid value it should still fail and not be casted to a different valid value.
So one would not be able to properly detect wrong behaving code.

Meaning in that case the dashboard widget should be fixed as well

@susnux
Copy link
Contributor

susnux commented Nov 26, 2025

This is not a warning because of coerce values but a real issue.
The error is thrown because the value is NOT a proper numeric value so this is on purpose and the correct behavior.
It was caused by the bug fixed here: nextcloud/photos#3187

@susnux susnux closed this Nov 26, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants