Skip to content

Conversation

heelc29
Copy link
Contributor

@heelc29 heelc29 commented Oct 1, 2025

Summary of Changes

The ord() function accepts the empty string (in which case it uses the null byte that terminates the C string and returns 0) and strings longer than one byte (in which case it returns the value of the first byte).
Both of these cases indicate some sort of programming bug, as such we propose deprecating this behaviour.

Deprecated: Providing a string which is not one byte long is deprecated, use $str[0] instead

https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_string_which_are_not_one_byte_long_to_ord

Testing Instructions

Run unit tests ./vendor/bin/phpunit

  • enable max error reporting
  • use php 8.5 (latest pre-version 8.5.0rc1)

Documentation Changes Required

no

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.

1 participant