Xdebug Configuration - Random Whitespace after IP

Viewed 60

I am fighting an Xdebug issue: For some reason a whitespace gets added behind the IP address when I am using my env. variable.

This is what my Xdebug config looks like:

zend_extension=xdebug
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=${PUBLIC_HOST_IP}
xdebug.log=/tmp/xdebug.log
xdebug.idekey=VSCODE

Within my browser php info file it looks fine:

enter image description here

But within my debug log it shows me:

WARN: Creating socket for '10.44.9.72 :9003', getaddrinfo: Invalid argument.

When I add the IP directly to the configuration, Xdebug is working fine, so the issue coming from the usage of the environmental variable. I also already send it through a replacement:

PUBLIC_HOST_IP=$(hostname -I)
export PUBLIC_HOST_IP=$(echo "${PUBLIC_HOST_IP}" | tr -d '[:space:]')

But without any luck for now ...

When I add a "1" behind my configuration, the whitespace also appears in the info php.

xdebug.client_host=${PUBLIC_HOST_IP}1

enter image description here

Also wrapping didnt help: xdebug.client_host="${PUBLIC_HOST_IP}"

When I write the variable to a text file:

echo $PUBLIC_HOST_IP >> test.txt

No whitespace is added to the end of the ip. Any clue how to get rid of that whitespace?

1 Answers

I have no damn clue why, but changing my config file from:

zend_extension=xdebug
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=${PUBLIC_HOST_IP}
xdebug.log=/tmp/xdebug.log
xdebug.idekey=VSCODE

To

zend_extension = xdebug
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = ${PUBLIC_HOST_IP}
xdebug.log = /tmp/xdebug.log
xdebug.idekey = VSCODE

Actually fixed it ...

Related