Skip to content

[PHP 8.3] Update functions#3106

Merged
saundefined merged 3 commits into
php:masterfrom
saundefined:php83-update-functions
Jan 16, 2024
Merged

[PHP 8.3] Update functions#3106
saundefined merged 3 commits into
php:masterfrom
saundefined:php83-update-functions

Conversation

@saundefined
Copy link
Copy Markdown
Member

No description provided.

@saundefined saundefined added this to the PHP 8.3 milestone Jan 12, 2024
@saundefined saundefined force-pushed the php83-update-functions branch from 3ebbe9f to 3c8f21c Compare January 12, 2024 13:51
Comment thread reference/var/functions/unserialize.xml Outdated
Comment thread reference/array/functions/array-sum.xml
Comment thread reference/array/functions/array-product.xml
Co-authored-by: Gina Peter Banyard <girgias@php.net>
Copy link
Copy Markdown
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

One nit and LGTM

Comment thread reference/array/functions/array-sum.xml Outdated
Co-authored-by: Gina Peter Banyard <girgias@php.net>
@saundefined saundefined merged commit 443d81b into php:master Jan 16, 2024
@saundefined saundefined deleted the php83-update-functions branch January 16, 2024 13:36
@DanielRuf
Copy link
Copy Markdown

I stumbled upon this PR during a migration to PHP 8.3:

array_sum() and array_product() now warn when values in the array cannot be converted to int/float.

This seems to be not the case. As we can see at https://3v4l.org/lKNfW#v8.3.20, the value (string) 3Hallo is converted to 3. So either the warning Warning: A non-numeric value encountered in or the documentation is not right.

Since cannot be converted to int/float. is not the case here, does this mean the documentation is inaccurate?

@DanielRuf
Copy link
Copy Markdown

Relevant PR: php/php-src#10161

@DanielRuf
Copy link
Copy Markdown

I think we should reword the part in the documentation, at least we should fix some grammar issues (where => were):

+ array_sum() and array_product() now warn when values in the array cannot be converted to int/float. Previously arrays and objects were ignored whilst every other value was cast to int. Moreover, objects that define a numeric cast (e.g. GMP) are now casted instead of ignored.
- array_sum() and array_product() now warn when values in the array cannot be converted to int/float. Previously arrays and objects where ignored whilst every other value was cast to int. Moreover, objects that define a numeric cast (e.g. GMP) are now casted instead of ignored.

@Girgias
Copy link
Copy Markdown
Member

Girgias commented May 6, 2025

Please open a new issue. Old PRs are basically never read nor the proper place to discuss stuff.

For the grammar issues feel free to open a PR.

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.

3 participants