View Issue Details

IDProjectCategoryView StatusLast Update
0001300XdebugUncategorizedpublic2020-03-12 16:46
Reporterstof Assigned Tostof  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.4.0 
Target Version2.5.1Fixed in Version2.5.1 
Summary0001300: XDebug functions are not exposing their signature to Reflection
Description

the Reflection API reports that functions have no arguments, while they actually have arguments for some of them

Steps To Reproduce

run "php --re xdebug" to see the output. compare it to "php --re json" to see the output for "json_encode" for instance.

TagsNo tags attached.
Operating System
PHP Version7.0.5-7.0.9

Activities

derick

2016-12-11 16:00

administrator   ~0003995

This seems like a good thing to do. Would you mind learning how to make such a patch yourself? It's not particularly difficult and I'm happy to give you pointers.

stof

2016-12-14 08:45

developer   ~0004063

yeah, I could learn how to do it

derick

2016-12-14 10:30

administrator   ~0004065

Okay, here are the pointers then:

At https://github.com/xdebug/xdebug/blob/master/xdebug.c#L109 you see a list with all of Xdebug's functions. The second argument is NULL instead of the "arginfo" that could be there.

arginfo structs are initialised with ZEND_BEGIN_ARG_INFO, or ZEND_BEGIN_ARG_INFO_EX.

This pull request (https://github.com/mgdm/Mosquitto-PHP/pull/3/files) adds for example ZEND_BEGIN_ARG_INFO structs to Mosquito. But it doesn't take into account the number of optional arguments. For that, you need the more complicated ZEND_BEGIN_ARG_INFO_EX.

The use of the more complicated ZEND_BEGIN_ARG_INFO_EX is seen in this Stack Overflow question: http://stackoverflow.com/questions/14635111/how-to-make-zend-begin-arg-info-ex-control-number-of-arguments-passed-to-a-php -- its answer also has a good overview of what it does (and doesn't).

But the SO question, uses "0, 0, " everywhere, where it really should use a constant for the first argument (as seen in the Mosquito PR's "ZEND_SEND_BY_VAL"), with the possibilities at http://lxr.php.net/xref/PHP-7.1/Zend/zend_compile.h#905; and the second argument is whether it returns a value or a reference (as denoted by the constants at http://lxr.php.net/xref/PHP-7.1/Zend/zend_compile.h#399).

The different items for each argument are defined at http://lxr.php.net/xref/PHP-7.1/Zend/zend_API.h#100 (ZEND_ARG_INFO etc.) With the pass_by_ref argument to this macro being either 0 or 1. (Always 0 in Xebug I think, as there is no pass_by_ref arguments).

Hope that helps :-)

derick

2016-12-14 11:58

administrator   ~0004066

I have assigned you too. Please read the contributing guidelines at https://xdebug.org/contributing.php

Thanks for volunteering :-)

stof

2016-12-14 13:27

developer   ~0004067

In which branch should I do it ? xdebug_2_5 or master ?

derick

2016-12-14 13:57

administrator   ~0004068

Your call. 2.5 is for bug fixes... The question is whether this is a bug fix or feature. I've tentatively scheduled it for 2.6 (master) though.

stof

2016-12-15 09:01

developer   ~0004074

For reference, PR is at https://github.com/xdebug/xdebug/pull/303

derick

2016-12-16 12:34

administrator   ~0004076

Thanks a lot Christophe! I have merged this now.

Issue History

Date Modified Username Field Change
2016-05-12 20:23 stof New Issue
2016-12-11 16:00 derick Note Added: 0003995
2016-12-11 16:00 derick Status new => acknowledged
2016-12-11 16:00 derick Target Version => 2.6.0dev
2016-12-13 21:46 derick Assigned To => derick
2016-12-13 21:46 derick Status acknowledged => feedback
2016-12-14 08:45 stof Note Added: 0004063
2016-12-14 08:45 stof Status feedback => assigned
2016-12-14 10:30 derick Note Added: 0004065
2016-12-14 10:31 derick Assigned To derick => stof
2016-12-14 11:58 derick Note Added: 0004066
2016-12-14 13:27 stof Note Added: 0004067
2016-12-14 13:57 derick Note Added: 0004068
2016-12-15 09:01 stof Note Added: 0004074
2016-12-16 12:34 derick Note Added: 0004076
2016-12-16 12:34 derick Status assigned => closed
2016-12-16 12:34 derick Resolution open => fixed
2016-12-16 12:34 derick Fixed in Version => 2.5.1
2016-12-18 01:18 derick Target Version 2.6.0dev => 2.5.1
2020-03-12 16:46 derick Category Feature/Change request => Uncategorized