View Issue Details

IDProjectCategoryView StatusLast Update
0001950XdebugTracingpublic2021-03-15 16:33
Reporterderick Assigned Toderick  
PriorityurgentSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.3 
Target Version3.0devFixed in Version3.0.4 
Summary0001950: Assignment trace with ASSIGN_OBJ_REF crashes
Description

When tracing with xdebug.collect_assignments, running through code that has a ASSIGN_OBJ_REF crashes. That happens with the following code:

<pre>
<?php
final class SessionBag
{
private $data;

public function __construct(array &$data)
{
    $this->data = &$data;
}

}

$data = [ 'one', 'two', 'three' ];
$a = new SessionBag( $data );
?>
</pre>

Steps To Reproduce

Save script to disk, run it with:

XDEBUG_TRIGGER=yes gdb --args php -n -dzend_extension=xdebug -dxdebug.collect_assignments=1 -dxdebug.mode=trace /tmp/test-class.php

You then get:

<pre>
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff43b91a8 in xdebug_find_var_name (execute_data=0x7ffff44150d0,
cur_opcode=0x0, lower_bound=0x0)
at /home/derick/dev/php/derickr-xdebug/src/tracing/tracing.c:296
296 if (cur_opcode->opcode == ZEND_QM_ASSIGN) {
(gdb) bt
#0 0x00007ffff43b91a8 in xdebug_find_var_name (execute_data=0x7ffff44150d0,
cur_opcode=0x0, lower_bound=0x0)
at /home/derick/dev/php/derickr-xdebug/src/tracing/tracing.c:296
#1 0x00007ffff43ba2a3 in xdebug_common_assign_dim_handler (
op=0x7ffff43c5849 "=&", execute_data=0x7ffff44150d0)
at /home/derick/dev/php/derickr-xdebug/src/tracing/tracing.c:588
0000002 0x00007ffff43ba713 in xdebug_assign_obj_ref_handler (
execute_data=0x7ffff44150d0)
at /home/derick/dev/php/derickr-xdebug/src/tracing/tracing.c:646
</pre>

Which is due to xdebug_find_referenced_opline in src/tracing/tracing.c:587 doing the wrong thing, and not getting the right opcode.

TagsNo tags attached.
Operating System
PHP Version8.0.0-8.0.4

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2021-02-24 11:16 derick New Issue
2021-02-24 11:16 derick Status new => assigned
2021-02-24 11:16 derick Assigned To => derick
2021-02-24 11:17 derick Target Version => 3.0dev
2021-03-14 16:44 derick Status assigned => closed
2021-03-14 16:44 derick Resolution open => fixed
2021-03-14 16:44 derick Fixed in Version => 3.0dev
2021-03-15 16:33 derick Fixed in Version 3.0dev => 3.0.4