Skip to content

[Debug] Remove $context arg from handleError(), preparing for PHP 7.2 #21389

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
Jan 24, 2017

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jan 24, 2017

Q A
Branch? 2.7
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

PHP 7.2 will trigger deprecation notices.
See https://wiki.php.net/rfc/deprecations_php_7_2#errcontext_argument_of_error_handler

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Jan 24, 2017
@@ -353,16 +353,14 @@ private function reRegister($prev)
* @param string $message
* @param string $file
* @param int $line
* @param array $context
* @param array $backtrace
*
* @return bool Returns false when no handling happens so that the PHP engine can handle the error itself
*
* @throws \ErrorException When $this->thrownErrors requests so
*
* @internal
Copy link
Member Author

Choose a reason for hiding this comment

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

Fortunately, this annotation is here from the beginning so we can change the signature without breaking our BC policy.

@nicolas-grekas nicolas-grekas force-pushed the debug-72 branch 2 times, most recently from 646b7b9 to f3211db Compare January 24, 2017 10:18
@stof
Copy link
Member

stof commented Jan 24, 2017

is there still a case where we will provide a context to the exception ? If no, we should deprecate ContextErrorException (which is here only to add the context)

@nicolas-grekas
Copy link
Member Author

Done in #21388

if (isset($context['GLOBALS']) && ($this->scopedErrors & $type)) {
if (4 < $numArgs = func_num_args()) {
$context = $scope ? func_get_arg(4) : array();
$backtrace = 5 < $numArgs ? func_get_arg(5) : null;
Copy link
Member

Choose a reason for hiding this comment

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

where is the backtrace comingfrom ? AFAIK, PHP never passes such argument

Copy link
Member Author

Choose a reason for hiding this comment

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

HHVM

Copy link
Member

Choose a reason for hiding this comment

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

In that case, can you add a small comment? That way, we can remove this piece of code more easily if we decide to drop HHVM support one day.

Copy link
Member Author

Choose a reason for hiding this comment

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

comment added

@fabpot
Copy link
Member

fabpot commented Jan 24, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 83cad14 into symfony:2.7 Jan 24, 2017
fabpot added a commit that referenced this pull request Jan 24, 2017
…g for PHP 7.2 (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Debug] Remove $context arg from handleError(), preparing for PHP 7.2

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

PHP 7.2 will trigger deprecation notices.
See https://wiki.php.net/rfc/deprecations_php_7_2#errcontext_argument_of_error_handler

Commits
-------

83cad14 [Debug] Remove $context arg from handleError(), preparing for PHP 7.2
@nicolas-grekas nicolas-grekas deleted the debug-72 branch January 24, 2017 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants