Web lists-archives.com

Why can't the PHP debugger find this object change?




I am trying to track down where a change to a PHP object takes place,
and the debugger is unable to step into the code where it happens.

I am tracing through a constructor with three assignments.

  public function __construct(
    DataDefinitionInterface $definition,
    $name = NULL,
    TypedDataInterface $parent = NULL
  ) {
    $this->definition = $definition;
    $this->parent = $parent;
    $this->name = $name;
  }

After the second of those three assignments is done, a fourth property
(defined by another class in the hierarchy) has changed from an empty
array to an array with a single element. The object has magic getters
and setters, but they don't get invoked here. The debugger won't step
into the assignment to the parent property, and it won't hit the
breakpoint on __set(). This is appropriate, because those magic
methods only kick in for properties which are undeclared or
inaccessible, and the parent property is declared as protected above
the constructor, and the object always has access to its own
properties. In those cases (elsewhere in the software) in which a
magic method is invoked, the debugger happily steps right in.

How is it possible that the debugger is unable to step into a
statement which is clearly doing more work than a simple assignment?

I am running PHP 7.2.10 under Apache 2.4.29 on Ubuntu 18.04.1,
debugging in VSCode 1.33.1 with Xdebug 2.6.0. The code being debugged
is from Drupal 8.7.0-dev.

Thanks in advance for any pointers to where to look. If there is a
better group/forum for asking this question, I'll be grateful if
someone can let me know.

- Bob Kline