Sitelet https://github.com/xdebug/xdebug/pull/164
Skip to content

XDEBUG_FILE in cookie - #164

Open
MoleDJ wants to merge 1 commit into
xdebug:masterfrom
MoleDJ:master
Open

MoleDJ wants to merge 1 commit into
xdebug:masterfrom
MoleDJ:master

Conversation

@MoleDJ

@MoleDJ MoleDJ commented Mar 16, 2015

Copy link
Copy Markdown

Add new format to xdebug.trace_output_name to allow set the filename from $_COOKIE "XDEBUG_FILE"

%K filename (from $_COOKIE if set) trace.%K trace.filename_in_set_in_the_XDEBUG_FILE_cookie.xt

@derickr

derickr commented Mar 19, 2015

Copy link
Copy Markdown
Contributor

I like this, but what's the reason why it is called XDEBUG_FILE ? It's just an arbitrary value that you can get from the GET parameters into the trace/profile filenames. Would it not make sense to pick a name that doesn't include FILE?

It would also be great if you could file an issue at http://bugs.xdebug.org as feature request, as per http://xdebug.org/contributing.php You probably should create a feature branch as well, instead of using "master".

@derickr

derickr commented Mar 24, 2015

Copy link
Copy Markdown
Contributor

Hey @MoleDJ — are you still interested in this?

@MoleDJ

MoleDJ commented Mar 26, 2015

Copy link
Copy Markdown
Author

Sorry for the delay, I already interested in this. the reason I want to add this is that I need to change the trace filename from the request side and I cannot use the url. In my exact setup, I need diferent trace file per each request I do, and I want to have this files named as I want so I can then match the results from webgrind to a database.

Sorry If I didn't put the change in the correct place, is my first contribution in github :)

@derickr

derickr commented Mar 27, 2015

Copy link
Copy Markdown
Contributor

Okay - I get that, but does the cookie needs to be called XDEBUG_FILE - instead of for example XDEBUG_EXTRA_INFO ? I can imagine other want to send something else and not a filename.

@MoleDJ

MoleDJ commented Mar 29, 2015

Copy link
Copy Markdown
Author

Oh, cookie name not need to be XDEBUG_FILE. Can be extra_info or any other best fit on your name schema.

@derickr
derickr force-pushed the master branch 2 times, most recently from 8e87621 to 6acaefc Compare June 15, 2015 20:18
@andypost

andypost commented Feb 6, 2017

Copy link
Copy Markdown
Contributor

And here should option to disable this behavior

@derickr derickr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've some questions/requests.

Comment thread usefulstuff.c
sess_name = "XDEBUG_FILE";

if (PG(http_globals)[TRACK_VARS_COOKIE] &&
zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), sess_name, strlen(sess_name) + 1, (void **) &data) == SUCCESS &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer sizeof(sess_name) here, and probably I'd prefer that line 656 and 658 are the same.

I would also argue that the name should not be XDEBUG_FILE, but instead XDEBUG_EXTRA_INFO.

What would be even better if it was an #define somewhere as a "constant".

Comment thread usefulstuff.c

if (PG(http_globals)[TRACK_VARS_COOKIE] &&
zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]), sess_name, strlen(sess_name) + 1, (void **) &data) == SUCCESS &&
Z_STRLEN_PP(data) < 100 /* Prevent any unrealistically long data being set as filename */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value "100" should also be a constant.

Comment thread usefulstuff.c
}
} break;

case 'K': { /* XDEBUG_FILE in cookie */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you pick "K" ? Can we make it "X", according to the xdebug_eXtra_info ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm new to this

@derickr

derickr commented Mar 6, 2017

Copy link
Copy Markdown
Contributor

Sorry, I'm just looking again at old(er) PRs. @andypost , why should there be an option to disable this?

@andypost

Copy link
Copy Markdown
Contributor

@derickr I misunderstood, as I see it escapes .. and /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants