Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix negative offset false positive on constant string #3784

Open
wants to merge 2 commits into
base: 1.12.x
Choose a base branch
from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jan 16, 2025

@ondrejmirtes
Copy link
Member

The bug report is about an error, the regression test should be in RuleTestCase.

if ($offsetType instanceof ConstantIntegerType) {
if ($offsetType->getValue() < strlen($this->value)) {
if ($strLenType->isSuperTypeOf($offsetType)->yes()) {
return new self($this->value[$offsetType->getValue()]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change also fixes a php warning which could happen on too small negative offsets (covered by the tests)

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.

2 participants