0

Description

xdebug seems to handle 0 as well as "0" values as null values if it is enabled and PhpStorm actively listens to incoming connections.

If xdebug is enabled but PhpStorm doesn't listen to connections ("the debugger is disabled" - so to speak), the website works perfectly fine.

If xdebug is disabled and PhpStorm doesn't listen to connections, the website works perfectly fine.

Example

This results in different errors in a Magento 2 project. And it seems this primarily occurs in PHPs magic functions like __call (\Magento\Framework\DataObject::__call). But that's just a guess and really hard to say as I'm always getting the right values if every step is debugged (0 stays 0).

I'm working on a Ubuntu machine with a PHP docker container.

php -v outputs the following information:

PHP 8.1.12 (cli) (built: Oct 28 2022 17:39:37) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.12, Copyright (c), by Zend Technologies
    with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans

xdebug is configured as follows:

zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = default
xdebug.client_host = "${HOST_IP}"
xdebug.client_port = 9000
xdebug.discover_client_host = false
xdebug.idekey = "PHPSTORM"

; xdebug error handling
xdebug.force_display_errors = 0
xdebug.halt_level = 0
xdebug.show_error_trace = 0
xdebug.show_exception_trace = 0

xdebug.scream = 0
xdebug.max_nesting_level = 512

Are there any known bugs or fixes for this issue?

Felix
  • 2,531
  • 14
  • 25
  • 2
    Xdebug does not change values itself. You're going to have to make a (small) reproducible example, and add a xdebug log. See what you'd need (just like for any bug report really), at https://xdebug.org/reporting-bugs – Derick Nov 07 '22 at 12:40
  • yeah, I've tried to reproduce it. I've created a custom `DataObject` class with a magic function but that works perfectly fine. The thing is I don't exactly know where PHP converts from `0` to `null` because if I take every debugging step, the issue does not occur. If xdebug is off, it doesn't occur. I just don't know exactly, how to create a reproducible example that behaves the same. – Felix Nov 07 '22 at 12:58

0 Answers0