Can't start xdebug: java.nio.charset.IllegalCharsetNameException
Describe the bug I'm trying to start an Xdebug session of a local PHP script, but it fails and I have the following entry in the log file:
!ENTRY org.eclipse.php.debug.core 4 4 2023-12-06 08:58:36.720
!MESSAGE class org.eclipse.php.internal.debug.core.xdebug.communication.XDebugCommunicationDaemon$CommunicationDaemon : Unexpected Exception: Listener thread still listening
!STACK 0
java.nio.charset.IllegalCharsetNameException:
at java.base/java.nio.charset.Charset.checkName(Charset.java:300)
at java.base/java.nio.charset.Charset.lookup2(Charset.java:496)
at java.base/java.nio.charset.Charset.lookup(Charset.java:476)
at java.base/java.nio.charset.Charset.isSupported(Charset.java:517)
at org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSession.getCharset(DBGpSession.java:777)
at org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSession.determineEncodings(DBGpSession.java:756)
at org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSession.setDebugTarget(DBGpSession.java:599)
at org.eclipse.php.internal.debug.core.xdebug.dbgp.model.DBGpTarget.SessionCreated(DBGpTarget.java:2164)
at org.eclipse.php.internal.debug.core.xdebug.dbgp.session.DBGpSessionHandler.fireSessionAdded(DBGpSessionHandler.java:121)
at org.eclipse.php.internal.debug.core.xdebug.communication.XDebugCommunicationDaemon$CommunicationDaemon.startConnection(XDebugCommunicationDaemon.java:223)
at org.eclipse.php.internal.debug.core.daemon.AbstractDebuggerCommunicationDaemon$ReceiverThread.run(AbstractDebuggerCommunicationDaemon.java:215)
at java.base/java.lang.Thread.run(Thread.java:1583)
Describe the eclipse environment Eclipse 2023-09 (4.29) PDT 8.2.0.202310152040
Describe your system
- OS: Windows
- Version 11 23H2
This is happening for me, and it is now July 2024. My configuration is similar to the original poster:
Environment: Eclipse 2023-09 (4.32) PDT Eclipse PDT 8.2.0.2023 11292129
System
- OS: Windows x64
- Version 11 23H2
- java 20.0.1 2023-04-18
@mlocati I finally figured out how to fix this myself. I found that the transfer and output encoding values were unset in the launch parameters. You can configure these values using the PHP Debug configuration Window->Preference under PHP/Debug:
After I set both values to UTF8 I was able to debug successfully.
FYI: I would still consider this a bug since:
- The DBGpSession class' getCharset() was unable to devise a workable, default character set, and,
- The debug session entered a sort of "hung" state