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

Resolve problem with mb_substr() on Laravel 9.x/10.x and PHP 8.1 #318

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Contracts/SolidityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function decode($value, $offset, $name)
$dynamicOffset = (int) Utils::toBn('0x' . mb_substr($value, $offset * 2, 64))->toString();
$length = (int) Utils::toBn('0x' . mb_substr($value, $dynamicOffset * 2, 64))->toString();
$roundedLength = floor(($length + 31) / 32);
$param = mb_substr($value, $dynamicOffset * 2, ( 1 + $roundedLength) * 64);
$param = mb_substr($value, $dynamicOffset * 2, (int)(( 1 + $roundedLength) * 64));
Copy link
Member

Choose a reason for hiding this comment

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

@ca-morfeusz2844 Thanks for your contribution. Is there any test case for this?

return $this->outputFormat($param, $name);
}
$length = $this->staticPartLength($name);
Expand Down