eclipse-pdt / pdt

PHP Development Tools project (PDT)
https://eclipse.org/pdt
Eclipse Public License 2.0
188 stars 45 forks source link

Can't start xdebug: java.nio.charset.IllegalCharsetNameException #261

Open mlocati opened 7 months ago

mlocati commented 7 months ago

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

kristianoye commented 3 weeks ago

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

kristianoye commented 3 weeks ago

@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: image

After I set both values to UTF8 I was able to debug successfully.

kristianoye commented 3 weeks ago

FYI: I would still consider this a bug since:

  1. The DBGpSession class' getCharset() was unable to devise a workable, default character set, and,
  2. The debug session entered a sort of "hung" state