Skip to content

Commit

Permalink
Merged pull request #392
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Dec 16, 2017
2 parents 4519199 + 0188565 commit 7f829a6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.10
PHP_BUILD_SDK_BRANCH: php-sdk-2.0.13
SDK_REMOTE: https://github.com/OSTC/php-sdk-binary-tools.git
SDK_BRANCH: php-sdk-2.0.10
SDK_BRANCH: php-sdk-2.0.13

matrix:
- PHP_REL: 7.2
Expand Down
1 change: 1 addition & 0 deletions tests/bug00625-1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ XDEBUG_CONFIG=
xdebug.default_enable=1
xdebug.overload_var_dump=2
xdebug.filename_format=
xdebug.profiler_enable=0
--FILE--
<?php
header( 'Location: bar');
Expand Down
1 change: 1 addition & 0 deletions tests/bug00625-2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ XDEBUG_CONFIG=
xdebug.default_enable=1
default_charset=utf-8
xdebug.filename_format=
xdebug.profiler_enable=0
--FILE--
<?php
header('Content-type: text/plain');
Expand Down
1 change: 1 addition & 0 deletions tests/bug00903.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Test for bug #903: xdebug_get_headers() returns replaced headers
--INI--
xdebug.default_enable=1
xdebug.overload_var_dump=1
xdebug.profiler_enable=0
--FILE--
<?php
header('foo: bar');
Expand Down
24 changes: 24 additions & 0 deletions tests/bug01437.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
Test for bug #1437: Add X-Xdebug-Profile-Filename header
--ENV--
XDEBUG_CONFIG=
--INI--
xdebug.default_enable=1
xdebug.overload_var_dump=2
xdebug.filename_format=
xdebug.profiler_enable=1
xdebug.profiler_output_name=XDEBUG-PROFILE.%p
--FILE--
<?php
header( 'Location: bar');
header( 'HTTP/1.0 404 Not Found' );
var_dump( xdebug_get_headers( ) );
?>
--EXPECTF--
%sbug01437.php:4:
array(2) {
[0] =>
string(%d) "X-Xdebug-Profile-Filename: %sXDEBUG-PROFILE%s"
[1] =>
string(13) "Location: bar"
}
9 changes: 9 additions & 0 deletions xdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,15 @@ void xdebug_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
(XG(profiler_enable) || xdebug_trigger_enabled(XG(profiler_enable_trigger), "XDEBUG_PROFILE", XG(profiler_enable_trigger_value) TSRMLS_CC))
) {
if (xdebug_profiler_init((char*) STR_NAME_VAL(op_array->filename) TSRMLS_CC) == SUCCESS) {
if (!SG(headers_sent)) {
sapi_header_line ctr = {0};

ctr.line = xdebug_sprintf("X-Xdebug-Profile-Filename: %s", XG(profile_filename));
ctr.line_len = strlen(ctr.line);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
xdfree(ctr.line);
}

XG(profiler_enabled) = 1;
}
}
Expand Down

0 comments on commit 7f829a6

Please sign in to comment.