Fix for php7.4: Trying to access array offset on value of type int#145
Fix for php7.4: Trying to access array offset on value of type int#145loverg-c wants to merge 3 commits into
Conversation
| if (!is_string($port)) { | ||
| $port = strval($port); | ||
| } | ||
| if ($port[0] !== ':') { |
There was a problem hiding this comment.
As strval() returns the unmodified string if you put a string into it, you might consider simplifying the code to
if ($port && strval($port)[0] !== ':') {
$port = ':' . $port;
}In my opinion, this would be easier to read and gave a better impression of what the code is doing.
Also, if $port is '' (empty string), it will get through the type safe not null check and this will call an undefined index on $port. This is just a notice in PHP, however, it won't occur with a weak null check.
There was a problem hiding this comment.
Just updated it, what do you think about this version ? :)
|
Thanks for the fix. Would be awesome if this PR can be merged so we can use it without the workaround! The build error seems to be related to the build environment and not so much about this PR. |
|
Can we get this PR merged so we don't have to use the workaround? |
|
Clément Lovergne seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This shoudl fix #143