Sitelet https://github.com/xdebug/xdebug/pull/164/files
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions usefulstuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,28 @@ int xdebug_format_output_filename(char **filename, char *format, char *script_na
}
} 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

zval **data;
char *char_ptr, *strval;
char *sess_name;

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".

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.

) {
strval = estrdup(Z_STRVAL_PP(data));

/* replace slashes, dots, question marks, plus signs,
* ampersands and spaces with underscores */
while ((char_ptr = strpbrk(strval, "/\\.?&+ ")) != NULL) {
char_ptr[0] = '_';
}
xdebug_str_add(&fname, strval, 0);
efree(strval);
}
} break;
case '%': /* literal % */
xdebug_str_addl(&fname, "%", 1, 0);
break;
Expand Down