Skip to content

parse_url does not return port as array, but it is used as array in R…#153

Open
brockhaus wants to merge 4 commits into
Kong:masterfrom
brockhaus:master
Open

parse_url does not return port as array, but it is used as array in R…#153
brockhaus wants to merge 4 commits into
Kong:masterfrom
brockhaus:master

Conversation

@brockhaus

Copy link
Copy Markdown

…equest.php

So I added a check, wether this is an array actually, else I use the port as intended as int. I would assume, that that array check is needless altogether but maybe old PHP versions needed that?

…equest.php

So I added a check, wether this is an array actually, else I use the port as intended as int. I would assume, that that array check is needless altogether but maybe old PHP versions needed that?
@CLAassistant

CLAassistant commented Jun 2, 2021

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@matthew-absops

Copy link
Copy Markdown

I do not believe this solution is sufficient. It is checking if the $port value returned by parse_url() is an array, which should never happen. I'm honestly not sure why this check was ever here, but maybe there's some history behind this built in function. Best I can tell, (parse_url($someURL))['port'] should always return an int. I believe the original intent for the check was using square brackets to access the index of a string (the first character), to ensure it wasn't a colon. Again, not sure how that would ever happen. But the proper check would be to cast the int to a string (if it's not null or is set), not see if it's an array.

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.

3 participants