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

Refined debug_backtrace return type #6268

Merged
merged 2 commits into from
Aug 12, 2021

Conversation

vudaltsov
Copy link
Contributor

Some explanations:

  • class and type are absent in a simple function call,
  • object is present only with DEBUG_BACKTRACE_PROVIDE_OBJECT option,
  • args is absent when DEBUG_BACKTRACE_IGNORE_ARGS option is used.

Also removed bool from options type, since it's not there according to docs.

@orklah
Copy link
Collaborator

orklah commented Aug 9, 2021

There was a time where php.net said this function could take a boolean where it's now flags:
https://web.archive.org/web/20090215184624/http://us3.php.net/debug_backtrace

Seems like it's stopped somewhere between 2009 and 2011 but some devs could be used to that. Conditional on it having the same behaviour as today, I'd vote to keep it possible

@vudaltsov
Copy link
Contributor Author

@orklah , agree, thank you for the information!

@weirdan
Copy link
Collaborator

weirdan commented Aug 9, 2021

Before 5.4 the first argument used to be called $provide_object, that's where bool comes from. It can't be kept there though, as PHP would throw at runtime with strict_types enabled (https://3v4l.org/2WXuL, https://3v4l.org/vORSW), thus Psalm needs to flag it.

@vudaltsov please revert the revert.

@vudaltsov
Copy link
Contributor Author

@weirdan , thank you! Done.

@weirdan
Copy link
Collaborator

weirdan commented Aug 9, 2021

@vudaltsov you will need to additionally edit either CallMap_historical (if the function had this signature before PHP 7.1) or one of the deltas (if there were changes during 7.1-8.0 period). That's why unit tests currently fail here.

@weirdan weirdan force-pushed the debug_backtrace-return-type branch from 6d10b80 to a335535 Compare August 12, 2021 22:45
@weirdan weirdan merged commit f7def9f into vimeo:master Aug 12, 2021
@weirdan
Copy link
Collaborator

weirdan commented Aug 12, 2021

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.

3 participants