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

Allow Throwable to be extended outside of Exception #17385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vishwamartur
Copy link

Related to #17233

Allow \Throwable to be extended directly without causing a Fatal error.

  • Zend/zend_exceptions.c

    • Remove the restriction in zend_implement_throwable function that checks if a class implementing \Throwable extends Exception or Error.
    • Update the zend_register_default_exception function to register the zend_ce_throwable interface without the restriction.
  • Zend/tests/bug_test.phpt

    • Add a new test file to ensure that extending \Throwable directly works as expected.
    • Add a test case to check if a class can extend \Throwable directly without causing a Fatal error.
    • Add a test case to check if a class extending \Throwable directly can implement the required methods.

Related to php#17233

Allow `\Throwable` to be extended directly without causing a Fatal error.

* **Zend/zend_exceptions.c**
  - Remove the restriction in `zend_implement_throwable` function that checks if a class implementing `\Throwable` extends `Exception` or `Error`.
  - Update the `zend_register_default_exception` function to register the `zend_ce_throwable` interface without the restriction.

* **Zend/tests/bug_test.phpt**
  - Add a new test file to ensure that extending `\Throwable` directly works as expected.
  - Add a test case to check if a class can extend `\Throwable` directly without causing a Fatal error.
  - Add a test case to check if a class extending `\Throwable` directly can implement the required methods.
@iluuu1994
Copy link
Member

See #17233 (comment). This change cannot land without an RFC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants