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

PHP: Implemented display of exception message when exception breakpoints are hit #6992

Conversation

troizet
Copy link
Collaborator

@troizet troizet commented Jan 24, 2024

The implementation is made for xdebug since version 3.1.6.
Tested on versions of xdebug: 3.1.6, 3.2.0, 3.3.0.

Code example:

<?php

class MyException extends Exception
{}

function throwException()
{
    throw new MyException("Test exception breakpoint", 42);
}

echo 'Test exception breakpoint';

$foo = $bar['foo'];

try {
    throwException();
} catch (Exception $e) {}

before:

before.mp4

after:

after.mp4

for throw new MyException("Test exception breakpoint") it looks like this:
without_code

for throw new MyException("", 42) it looks like this:
with_code_without_message

for throw new MyException("") and throw new MyException() it looks like this:
with_empty_message

How it looks in a dark theme:
exception_message_dark_theme

@troizet troizet added the PHP [ci] enable extra PHP tests (php/php.editor) label Jan 24, 2024
@junichi11 junichi11 added this to the NB22 milestone Jan 24, 2024
@junichi11
Copy link
Member

Thank you for the example code and screenshots! It's easy to understand :)

@junichi11
Copy link
Member

@troizet Could you change the target branch from the master to php-nb22-features?

@troizet troizet force-pushed the php_exception_breakpoint_show_message branch from 401c2ce to 9793949 Compare January 25, 2024 05:22
@troizet troizet changed the base branch from master to php-nb22-features January 25, 2024 05:23
@troizet
Copy link
Collaborator Author

troizet commented Jan 25, 2024

I made the suggested changes and rebased the branch.

Copy link
Member

@tmysik tmysik left a comment

Choose a reason for hiding this comment

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

Several comments added, please look into them. Thanks for your work!

@troizet troizet force-pushed the php_exception_breakpoint_show_message branch from 9793949 to 18792e6 Compare January 31, 2024 12:11
@tmysik
Copy link
Member

tmysik commented Feb 1, 2024

Looks good to me, with just one change remaining. Please, look into it. Thanks!

@troizet troizet force-pushed the php_exception_breakpoint_show_message branch from 18792e6 to da5a813 Compare February 4, 2024 07:10
@tmysik
Copy link
Member

tmysik commented Feb 4, 2024

Looks good to me now. What about @junichi11?

Copy link
Member

@junichi11 junichi11 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you for your work!

@junichi11
Copy link
Member

Thank you, guys! Merging.

@junichi11 junichi11 merged commit b33890d into apache:php-nb22-features Feb 4, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants