[PHP 8.5] Introduce PhpVersion::DEPRECATE_ORD_WITH_MULTIBYTE_STRING#7191
Closed
arshidkv12 wants to merge 0 commit intorectorphp:mainfrom
Closed
[PHP 8.5] Introduce PhpVersion::DEPRECATE_ORD_WITH_MULTIBYTE_STRING#7191arshidkv12 wants to merge 0 commit intorectorphp:mainfrom
arshidkv12 wants to merge 0 commit intorectorphp:mainfrom
Conversation
samsonasik
reviewed
Aug 29, 2025
|
|
||
| $argExpr = $args[0]->value; | ||
|
|
||
| $value = $this->valueResolver->getValue($argExpr); |
Member
There was a problem hiding this comment.
this needs check if $value is null which may can be fetch from variable:
function foo($x)
{
echo ord($x);
}which we don't know the context, so should be skipped.
Member
|
when switch between branch on multiple PRs, please start over checkout from main instead of last branch so commits are not mixed up: |
Contributor
Author
|
Thank you |
Contributor
Author
git pull upstream main 3 ✘
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights |
Member
|
You may need to use |
6f2496c to
e57a273
Compare
samsonasik
reviewed
Sep 4, 2025
| @@ -0,0 +1,9 @@ | |||
| <?php | |||
| namespace Rector\Tests\Php85\Rector\FuncCall\OrdSingleByteRector\Fixture; | |||
| echo ord(123); | |||
Member
There was a problem hiding this comment.
please add test for:
$var = 123;
echo ord($var);
samsonasik
reviewed
Sep 4, 2025
| @@ -0,0 +1,9 @@ | |||
| <?php | |||
| namespace Rector\Tests\Php85\Rector\FuncCall\OrdSingleByteRector\Fixture; | |||
| echo ord('abc'); | |||
Member
There was a problem hiding this comment.
please add test for:
$var = 'abc';
echo ord($var);
samsonasik
reviewed
Sep 4, 2025
Comment on lines
80
to
82
| $isInt = is_int($value); | ||
| $value = (string) $value; | ||
| $byte = $value[0] ?? ''; |
Member
There was a problem hiding this comment.
probably verify its $argExpr type itself:
$type = $this->nodeTypeResolver->getNativeType($argExpr);
if (! $type->isInteger()->yes() && ! $type->isString()->yes()) {
return null;
}
46ebae7 to
9da7aa0
Compare
9da7aa0 to
d04dcf7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_string_which_are_not_one_byte_long_to_ord