Skip to content

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.

3 participants