D
D
Dmitry Vasiliev2021-05-15 18:09:33
PHP
Dmitry Vasiliev, 2021-05-15 18:09:33

Error in xdebug documentation?

Good day to all! Somehow it so accidentally happened that along the chain " Questions for an interview " (paragraph Copy-on-write) -> an article with a more detailed explanation -> PHP documentation -> hdebug extension documentation, I found a discrepancy between theory and practice. According to the documentation, the code

$a = "new string";
xdebug_debug_zval('a');


It should output something like:

a: (refcount=1, is_ref=0)='new string'

But in fact (there is PHP 8.0.6 TS on the server),

a: (interned, is_ref=0)='new string'

A code is displayed in the console

$a = array(1, 2, 3);
    $b =& $a;
    $c =& $a[2];

    xdebug_debug_zval('a');
    xdebug_debug_zval("a[2]");


which , according to the documentation , should issue

a: (refcount=2, is_ref=1)=array (
  0 => (refcount=1, is_ref=0)=1, 
  1 => (refcount=1, is_ref=0)=2, 
  2 => (refcount=2, is_ref=1)=3)
a[2]: (refcount=2, is_ref=1)=3


in fact gives

a: (refcount=2, is_ref=1)=array (
    0 => (refcount=0, is_ref=0)=1,
    1 => (refcount=0, is_ref=0)=2,
    2 => (refcount=2, is_ref=1)=3)
a[2]: (refcount=2, is_ref=1)=3


Not that I was very worried about it, but still: what could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nokimaro, 2021-05-15
@DerevoXP

the reason is that there is no up-to-date example in the documentation (you can create an issue and help improve the documentation)
"interned" appeared with xdebug 3.0.0beta1
https://bugs.xdebug.org/bug_view_page.php?bug_id=0...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question