Skip to content

PHP 7.4 fix - Ensure the existence of the 'args' key. #202

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 4 commits into from
Feb 10, 2020
Merged

PHP 7.4 fix - Ensure the existence of the 'args' key. #202

merged 4 commits into from
Feb 10, 2020

Conversation

drupol
Copy link
Contributor

@drupol drupol commented Feb 10, 2020

This simple fix for ensuring the existence of the 'args' key.

With PHP 7.4 on Linux and Windows, it fails without it.
Weird thing is that it doesn't break on MacOSX.

See it live here: https://github.com/ecphp/cas-bundle/actions/runs/36937260

@GrahamCampbell
Copy link
Contributor

Weird thing is that it doesn't break on MacOSX.

Probably due to the error reporting level configuration.

@drupol
Copy link
Contributor Author

drupol commented Feb 10, 2020

Oops, it's not a valid solution.

@drupol
Copy link
Contributor Author

drupol commented Feb 10, 2020

I have an error when using $call['args'] ?? [].
PHP Fatal error: Only variables can be passed by reference in /home/pol/dev/git/b4/cas-bundle/vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/InvalidTag.php on line 107

Copy link
Member

@jaapio jaapio left a comment

Choose a reason for hiding this comment

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

Thanks for your PR, I'm very curious why this was happening. If you have the fix in place it could be that you still have issues using this library because this is a new concept in v5. The original processed tag contained an issue which cannot be solved. To make sure the docblock parsing can continue we introduced this fallback. In normal sitations you should not get an instance like this one. Mostlikely you have an issue in a dockblock in your code.
There are a number of things that you could do:

  • Debug your code and see what tag ends here.
  • Run phpdoc v3.0.0-rc against your code base, and check the error report in the generated docs.

Could your please update the implementation and run the tests.

You should be able to run the following commands if you have docker installed.
make setup test

Please let me know if you have any issues running the tests or with fixing this issue.

@drupol
Copy link
Contributor Author

drupol commented Feb 10, 2020

Investigating further... I think I have found something...

image

@jaapio
Copy link
Member

jaapio commented Feb 10, 2020

Ha yes, that author tag is invalid, the second string between <> should be an e-mail address. But you still might need the suggested fix because your code should not break on the current error. This class was introduced to bypass the invalid tags ;-)

@drupol
Copy link
Contributor Author

drupol commented Feb 10, 2020

@jaapio There is no PHPDoc issue in my sources as far as I can see, I really think in this case, we should definitely commit this fix.
I fixed the previous commit and it should be good to go now.
Let me know what you think.

@jaapio jaapio merged commit e2ce1d2 into phpDocumentor:master Feb 10, 2020
@jaapio
Copy link
Member

jaapio commented Feb 10, 2020

Thanks for this fix!

@drupol drupol deleted the fix-for-php74 branch February 10, 2020 20:24
@drupol
Copy link
Contributor Author

drupol commented Feb 10, 2020

Thank you you !

@vkunz
Copy link

vkunz commented Feb 12, 2020

hi,

php-7.4 introduced a new ini config flag allowing to disable/enable the args index.

@drupol
Copy link
Contributor Author

drupol commented Feb 12, 2020

hi,

php-7.4 introduced a new ini config flag allowing to disable/enable the args index.

Good to know, thanks !

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.

4 participants