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

PHP 8 support #45

Merged
merged 23 commits into from
Dec 29, 2020
Merged

PHP 8 support #45

merged 23 commits into from
Dec 29, 2020

Conversation

ocean
Copy link
Contributor

@ocean ocean commented Oct 13, 2020

Updating to add PHP 8.0 support for #44

First draft of PR for TravisCI testing.

@ocean ocean changed the title Php8 support PHP 8 support Oct 13, 2020
@boesing boesing added Enhancement hacktoberfest-accepted Issues/Pull-Requests which can be fixed during Hacktoberfest: https://hacktoberfest.digitalocean.com labels Oct 13, 2020
@boesing boesing added this to the 2.12.0 milestone Oct 13, 2020
@boesing boesing linked an issue Oct 13, 2020 that may be closed by this pull request
6 tasks
Copy link
Member

@boesing boesing left a comment

Choose a reason for hiding this comment

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

LGTM so far.

You might want to have a look on the failing unit tests.
Some methods got dropped in phpunit 9 so we have to find a better way to verify what've happened.

@ocean
Copy link
Contributor Author

ocean commented Oct 13, 2020

@boesing thanks. Yep, I'm having a look at the breaking tests on Travis at the moment.

There are deprecations in PHP-CodeSniffer too, which is brought in by laminas/laminas-coding-standard which I noticed was at version ~1.0.0 still - I've just updated that in Composer to version ~2.1.0 and will try it out now - does that sound ok?

@boesing
Copy link
Member

boesing commented Oct 13, 2020

I would prefer not upgrading codestyle in here to have a clear overview on what've changed or PHP 8.0.

If there are issues with codesniffer, we can bump dev-dependency for that package to ensure it always works with PHP 8.0.
But afaik, codestyle should not be checked on 8.0 so there is probably no issue but locally?

Signed-off-by: Drew Robinson <[email protected]>
…iffer library"

This reverts commit d1d3b03.

Signed-off-by: Drew Robinson <[email protected]>
Signed-off-by: Drew Robinson <[email protected]>
Signed-off-by: Drew Robinson <[email protected]>
@boesing
Copy link
Member

boesing commented Oct 31, 2020

@ocean If I can help you, just ping me 👍

@ocean
Copy link
Contributor Author

ocean commented Nov 6, 2020

Sorry I haven't had a chance to get back to this until now @boesing

I would happy with some help. The test issue I've found most annoying is the lack of ability to access protected properties e.g. here https://travis-ci.com/github/laminas/laminas-http/jobs/400060420#L555

@boesing
Copy link
Member

boesing commented Nov 17, 2020

Sorry I haven't had a chance to get back to this until now @boesing

I would happy with some help. The test issue I've found most annoying is the lack of ability to access protected properties e.g. here https://travis-ci.com/github/laminas/laminas-http/jobs/400060420#L555

No problem, we all have plenty of stuff to do 💪
You could test the auth property by writing a little private "helper" method to extract the value of a property which is not accessible. However, we might want to keep in mind that testing non-public properties is not how tests should work.

So, you could do sth. like this:

$valueFromProperty = $this->extractPropertyValue($objectYouWantToExtractThePropertyFrom, 'propertyName');
self::assertEquals($expectedValue, $valueFromProperty);

Within the extractPropertyValue "helper" method, you can use ReflectionProperty to extract the value. Have a look at the ReflectionProperty::setAccessible method.

@ocean
Copy link
Contributor Author

ocean commented Nov 19, 2020

@boesing GitHub still says there's a review to do on this PR, but I can't see one.

Also it seems the TravisCI jobs for this repo have stopped running 😞 I ran tests on my local machine with PHP 7.4 and they seemed ok, but am keen to see what Travis does with PHP latest.

@boesing
Copy link
Member

boesing commented Nov 19, 2020

@ocean Thats fine, we have to review manually with each supported PHP version as we ran out of build hours on travis.
Sorry for the delay tho.

Copy link
Member

@boesing boesing left a comment

Choose a reason for hiding this comment

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

https://travis-ci.com/github/ocean/laminas-http/jobs/452211509#L709

Hm, thats a tough one as I am not that deep into that stuff and TBH I don't have time to dig into that.
Maybe @domoran could provide some insights here as he added this test 4 years ago?

.travis.yml Show resolved Hide resolved
@ocean
Copy link
Contributor Author

ocean commented Dec 21, 2020

@boesing I updated the curl chunked response test to test against "less than 25 milliseconds completion" instead of 20 milliseconds. This has made the test pass, meaning we can move on from this hopefully.

@samsonasik
Copy link
Member

@ocean I tried in my local dev with php 8 and it working ok 👍

Screen Shot 2020-12-21 at 5 31 25 PM

@domoran
Copy link
Contributor

domoran commented Dec 21, 2020

Please note, that the 20, 25 in this test do not mean "ms" but it defines the factor on how long it takes to parse the chunked response, compared to the baseline [2000 chunks a 1 byte] vs [2000 chunks a 1 byte + 1 chunk 10 MB]. Its kind of hard to make a prediction on how long this is supposed to take - in the original implementation due to a very bad string handling the 10 MB chunk was copied thousands of times, making the packet take multiple minutes to parse.

Since a test was required to perform the change on the zend http library I made this test to reproduce the problem and see that it was fixed - however the test has only the purpose to make sure the specific problem of the old implementation is gone. So there is nothing wrong with increasing the asserted ratio as long as it is ensured that the absolute times of parsing such a response are still reasonable (maybe sub 500ms?).

Please also note, that the response should have never been loaded into memory anyways, because with large responses this will break any memory limit anyway. But that change was too big to perform at that time. So I would suggest switching to another HTTP library anyway, that does not suffer from this issue.

phpunit.xml.dist Outdated Show resolved Hide resolved
Co-authored-by: Frank Brückner <[email protected]>
Signed-off-by: Drew Robinson <[email protected]>
@ocean
Copy link
Contributor Author

ocean commented Dec 21, 2020

@domoran Thanks very much for the clarification. I see, so it is more like "this test should take less than 20 times as long as parsing the initial baseline response".

@samsonasik Thanks for your double-checking input too. The test was passing on my local as well, but failing on Travis (but only by one or two increments), so I guess it's mostly caused by the limited speed of the Travis CI servers.

@froschdesign Thanks, updated that schema version string now, ready for review 👍

@boesing
Copy link
Member

boesing commented Dec 22, 2020

Thanks @domoran for spending time on this! Thats really appreciated.
@ocean I'll try to create a new release next week between Christmas and NYE.

@samsonasik
Copy link
Member

@boesing it is already next week, I will merge it right now ;)

@samsonasik samsonasik merged commit 541d400 into laminas:2.14.x Dec 29, 2020
@samsonasik
Copy link
Member

Oh, the milestone is 2.12, automatic release is not working

@samsonasik samsonasik modified the milestone: 2.14.0 Dec 29, 2020
@samsonasik
Copy link
Member

trying create milestone 2.14.0 and re-close the milestone

@samsonasik
Copy link
Member

2.14.0 released https://github.com/laminas/laminas-http/releases/tag/2.14.0 🎉
Thank you all ;)

@SamuelNitsche
Copy link

May I ask why this was released without a PHP 8 compatible version of laminas/laminas-validator?

@Ocramius
Copy link
Member

@SamuelNitsche one thing at a time - laminas/laminas-validator#75 just needs reviews, if you got time, and then it can certainly be released IMO

@SamuelNitsche
Copy link

Got it, thanks @Ocramius!

@boesing
Copy link
Member

boesing commented Dec 30, 2020

Thanks @samsonasik 😄
and yes, but this week has still 4 days left 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement hacktoberfest-accepted Issues/Pull-Requests which can be fixed during Hacktoberfest: https://hacktoberfest.digitalocean.com
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 8.0 support
8 participants