Skip to content

PHP 7.2 compatibility: check if sortedRouters is null before trying to count it #200

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

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

maff
Copy link
Contributor

@maff maff commented Sep 26, 2017

Starting from PHP 7.2, count(null) yields a warning (see https://3v4l.org/hbmpC).

Alternatively sortedRouters could be initialized as empty array and trigger a sort if count of sortedRouters differs from routers , but I don't know the exact background of this logic.

@dbu
Copy link
Member

dbu commented Sep 26, 2017

thank you for checking this and providing a fix! lets initialize in the property declaration with an empty array, its also what the add() method does to reset the sortedRouter field. can you please adjust the pull request accordingly?

@maff maff force-pushed the php7.2-count-routers branch from 2c1a744 to 27192b1 Compare September 26, 2017 16:56
@maff
Copy link
Contributor Author

maff commented Sep 26, 2017

Ah right, didn't see that in the add()method. PR is updated.

@dbu dbu merged commit a1532a9 into symfony-cmf:master Sep 27, 2017
@dbu
Copy link
Member

dbu commented Sep 27, 2017

thanks a lot. i will tag 2.0.2 with this today.

@dbu
Copy link
Member

dbu commented Sep 28, 2017

i now tagged.

i wanted to run the tests with php 7.2 too so we can be sure its alright, but unfortunately there is a failure in the dependencies that i have troubles figuring out. phpcr/phpcr-utils#174

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