View Issue Details

IDProjectCategoryView StatusLast Update
0001286XdebugUsage problems (Wrong Results)public2018-01-29 21:46
ReporterjboffelAssigned Toderick 
PriorityhighSeveritycrashReproducibilityalways
Status resolvedResolutionunable to reproduce 
Product Version2.3.3 
Target VersionFixed in Version 
Summary0001286: When generating trace file with xdebug.collect_params = 4 it will crash if one of the param is a closure
DescriptionThose are my Xdebug settings:

xdebug.trace_enable_trigger = 1
xdebug.trace_format = 0
xdebug.trace_output_name = "xdebug_trace.%p.%s.%u"
xdebug.collect_params = 5
xdebug.show_mem_delta = 1
xdebug.collect_return = 1

zend_extension="/usr/local/xxxx/5.6.8/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"


If I load a webpage running php with trace file cookie activated it will crash if one of the serialized param is a closure.

I then get that in the error.log:

[Thu Mar 17 10:56:47.008717 2016] [:error] [pid 18000] [client xxxxxx] PHP Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'Closure' is not allowed'

If I change to collect_params = 4, restart apache and refresh then the problem does not occure.
Steps To Reproduce
Set these settings in xdebug.ini:

xdebug.trace_enable_trigger = 1
xdebug.trace_format = 0
xdebug.trace_output_name = "xdebug_trace.%p.%s.%u"
xdebug.collect_params = 5
xdebug.show_mem_delta = 1
xdebug.collect_return = 1

zend_extension="/usr/local/xxxx/5.6.8/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"

Restart apache or other webserver.

Create a webpage in PHP which will call at least one function with one of its parameter as a closure.

Enable trace functionnality throw the cookie for example.

Load the page.
Additional InformationI belive the os version is not useful for this problem so I didn't fill the field. But just for information it is centos el6
TagsNo tags attached.
Operating System
PHP Version5.6.5-5.6.9

Activities

jboffel

2016-03-17 02:18

reporter   ~0003571

Sorry for the mistake in the summary seems I could not change it myself but it is for xdebug.collect_params = 5 of course...

derick

2016-05-10 22:27

administrator   ~0003592

Could you please provide a reproducible script? I'm having trouble reproducing this myself.

jboffel

2016-05-11 03:56

reporter   ~0003600

well I'd believe that this simple script should already raise an issue:

<?php

function testClosureParamSerialization(callable $fn) {
    $fn('hello');
}

testClosureParamSerialization(
     function($a) {
         echo $a;
     }
);

derick

2016-05-29 09:11

administrator   ~0003617

I have just tried this with PHP 5.6.23, and I can not reproduce this. I get
a "N;" (base64 encoded); in the trace file. What does the following do for you:

php -n -dzend_extension=xdebug.so -dxdebug.auto_trace=1 -dxdebug.trace_format=0

do? Does that still crash? Can you try a later PHP 5.6.x version?

jboffel

2016-05-30 08:01

reporter   ~0003622

Hello,

I've been giving a quick try and I've to agree that simple script does not crash. I'm not sure how to reproduce it then as the original use case was very complex (a lot of code involved) and I just trusted the error reported as the root cause.

So I thought this script should do something already but it must be of higher complexity than that.

However is it normal to get a N; base64 encoded? I was somehow expecting the text return in collect_parameter=4 base64 encoded...

I guess it is somehow also related to the non serializability of the closure? Maybe with some more complex use case the test fail to see that one of the parameter include a closure and crash instead of putting N; instead?

derick

2016-12-04 15:52

administrator   ~0003909

I haven't had the time to reproduce this.

derick

2017-03-19 22:21

administrator   ~0004239

Hi, I've tried reproducing this again, but I am still not having success.
I'm afraid I will need a (short) and fully contained reproducible case that
I can run locally to investigate and fix this issue.

derick

2018-01-29 21:46

administrator   ~0004576

Can't reproduce this, and no feedback provided.

Issue History

Date Modified Username Field Change
2016-03-17 02:16 jboffel New Issue
2016-03-17 02:18 jboffel Note Added: 0003571
2016-05-10 22:27 derick Note Added: 0003592
2016-05-10 22:27 derick Assigned To => derick
2016-05-10 22:27 derick Status new => feedback
2016-05-11 03:56 jboffel Note Added: 0003600
2016-05-11 03:56 jboffel Status feedback => assigned
2016-05-29 09:11 derick Note Added: 0003617
2016-05-29 09:11 derick Status assigned => feedback
2016-05-30 08:01 jboffel Note Added: 0003622
2016-05-30 08:01 jboffel Status feedback => assigned
2016-07-31 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2016-12-04 15:52 derick Note Added: 0003909
2016-12-04 15:52 derick Status assigned => acknowledged
2017-03-19 22:21 derick Note Added: 0004239
2017-03-19 22:21 derick Status acknowledged => feedback
2018-01-29 21:46 derick Note Added: 0004576
2018-01-29 21:46 derick Status feedback => resolved
2018-01-29 21:46 derick Resolution open => unable to reproduce