Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,413 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--TEST-- | ||
Filtered code coverage: path blacklist [1] | ||
--INI-- | ||
xdebug.auto_trace=0 | ||
xdebug.collect_return=1 | ||
xdebug.collect_params=4 | ||
xdebug.collect_assignments=0 | ||
xdebug.trace_format=0 | ||
--FILE-- | ||
<?php | ||
$cwd = __DIR__; $s = DIRECTORY_SEPARATOR; | ||
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_PATH_BLACKLIST, [ "{$cwd}{$s}filter{$s}xdebug" ] ); | ||
|
||
$tf = xdebug_start_code_coverage( XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED ); | ||
|
||
include "$cwd/filter/foobar/foobar.php"; | ||
include "$cwd/filter/xdebug/xdebug.php"; | ||
|
||
Foobar::foo("hi"); | ||
XDEBUG::foo("hi"); | ||
Xdebug::foo("hi"); | ||
|
||
$result = xdebug_get_code_coverage(); | ||
ksort( $result ); | ||
|
||
var_dump( $result ); | ||
?> | ||
--EXPECTF-- | ||
ello! | ||
ello! | ||
ello! | ||
array(2) { | ||
["%scoverage-filter-path-black-1.php"]=> | ||
array(7) { | ||
[5]=> | ||
int(1) | ||
[7]=> | ||
int(1) | ||
[8]=> | ||
int(1) | ||
[10]=> | ||
int(1) | ||
[11]=> | ||
int(1) | ||
[12]=> | ||
int(1) | ||
[14]=> | ||
int(1) | ||
} | ||
["%sfilter%efoobar%efoobar.php"]=> | ||
array(6) { | ||
[2]=> | ||
int(1) | ||
[6]=> | ||
int(1) | ||
[7]=> | ||
int(1) | ||
[11]=> | ||
int(-1) | ||
[12]=> | ||
int(-1) | ||
[14]=> | ||
int(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--TEST-- | ||
Filtered code coverage: path whitelist [1] | ||
--INI-- | ||
xdebug.auto_trace=0 | ||
xdebug.collect_return=1 | ||
xdebug.collect_params=4 | ||
xdebug.collect_assignments=0 | ||
xdebug.trace_format=0 | ||
--FILE-- | ||
<?php | ||
$cwd = __DIR__; $s = DIRECTORY_SEPARATOR; | ||
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_PATH_WHITELIST, [ "{$cwd}{$s}filter{$s}xdebug" ] ); | ||
|
||
$tf = xdebug_start_code_coverage( XDEBUG_CC_DEAD_CODE | XDEBUG_CC_UNUSED ); | ||
|
||
include "$cwd/filter/foobar/foobar.php"; | ||
include "$cwd/filter/xdebug/xdebug.php"; | ||
|
||
Foobar::foo("hi"); | ||
XDEBUG::foo("hi"); | ||
Xdebug::foo("hi"); | ||
|
||
$result = xdebug_get_code_coverage(); | ||
ksort( $result ); | ||
|
||
var_dump( $result ); | ||
?> | ||
--EXPECTF-- | ||
ello! | ||
ello! | ||
ello! | ||
array(2) { | ||
["%scoverage-filter-path-white-1.php"]=> | ||
array(7) { | ||
[5]=> | ||
int(1) | ||
[7]=> | ||
int(1) | ||
[8]=> | ||
int(1) | ||
[10]=> | ||
int(1) | ||
[11]=> | ||
int(1) | ||
[12]=> | ||
int(1) | ||
[14]=> | ||
int(1) | ||
} | ||
["%sfilter%exdebug%exdebug.php"]=> | ||
array(6) { | ||
[2]=> | ||
int(1) | ||
[6]=> | ||
int(1) | ||
[7]=> | ||
int(1) | ||
[11]=> | ||
int(-1) | ||
[12]=> | ||
int(-1) | ||
[14]=> | ||
int(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
xdebug_set_filter() wrong arguments | ||
--INI-- | ||
html_errors=0 | ||
display_errors=1 | ||
--FILE-- | ||
<?php | ||
xdebug_set_filter(42, XDEBUG_PATH_BLACKLIST, [ "xdebug" ] ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, 42, [ "xdebug" ] ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_NAMESPACE_BLACKLIST, [ "xdebug" ] ); | ||
xdebug_set_filter(XDEBUG_FILTER_CODE_COVERAGE, XDEBUG_NAMESPACE_WHITELIST, [ "xdebug" ] ); | ||
?> | ||
--EXPECTF-- | ||
Warning: Filter group needs to be one of XDEBUG_FILTER_TRACING or XDEBUG_FILTER_CODE_COVERAGE in %sfilter-errors.php on line 2 | ||
|
||
Warning: Filter type needs to be one of XDEBUG_PATH_WHITELIST, XDEBUG_PATH_BLACKLIST, XDEBUG_NAMESPACE_WHITELIST, XDEBUG_NAMESPACE_BLACKLIST, or XDEBUG_FILTER_NONE in %sfilter-errors.php on line 4 | ||
|
||
Warning: The code coverage filter (XDEBUG_FILTER_CODE_COVERAGE) only supports the XDEBUG_PATH_WHITELIST, XDEBUG_PATH_BLACKLIST, and XDEBUG_FILTER_NONE filter types in %sfilter-errors.php on line 6 | ||
|
||
Warning: The code coverage filter (XDEBUG_FILTER_CODE_COVERAGE) only supports the XDEBUG_PATH_WHITELIST, XDEBUG_PATH_BLACKLIST, and XDEBUG_FILTER_NONE filter types in %sfilter-errors.php on line 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
class Foobar | ||
{ | ||
static function foo($s) | ||
{ | ||
echo strstr("Hello!\n", "e"); | ||
} | ||
|
||
static function not_used() | ||
{ | ||
echo "this function does not get called\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace Stack; | ||
|
||
class One | ||
{ | ||
function __construct( $object ) | ||
{ | ||
$this->obj = $object; | ||
} | ||
|
||
function callObj( string $name, ...$arguments ) | ||
{ | ||
return $this->obj->$name( ...$arguments ); | ||
} | ||
|
||
function error( $value ) | ||
{ | ||
trigger_error( $value, E_USER_WARNING ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace Stack; | ||
|
||
class Three | ||
{ | ||
function __construct( $object ) | ||
{ | ||
$this->obj = $object; | ||
} | ||
|
||
function callObj( string $name, ...$arguments ) | ||
{ | ||
return $this->obj->$name( ...$arguments ); | ||
} | ||
|
||
function error( $value ) | ||
{ | ||
trigger_error( $value, E_USER_WARNING ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace Stack; | ||
|
||
class Two | ||
{ | ||
function __construct( $object ) | ||
{ | ||
$this->obj = $object; | ||
} | ||
|
||
function callObj( string $name, ...$arguments ) | ||
{ | ||
return $this->obj->$name( ...$arguments ); | ||
} | ||
|
||
function error( $value ) | ||
{ | ||
trigger_error( $value, E_USER_WARNING ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
class Xdebug | ||
{ | ||
static function foo($s) | ||
{ | ||
echo strstr("Hello!\n", "e"); | ||
} | ||
|
||
static function not_used() | ||
{ | ||
echo "this function does not get called\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--TEST-- | ||
Filtered stack traces: namespace blacklist [1] | ||
--INI-- | ||
xdebug.default_enable=1 | ||
xdebug.auto_trace=0 | ||
xdebug.collect_params=4 | ||
--FILE-- | ||
<?php | ||
$cwd = __DIR__; | ||
|
||
include "$cwd/filter/stack/one.php"; | ||
include "$cwd/filter/stack/two.php"; | ||
include "$cwd/filter/stack/three.php"; | ||
|
||
$three = new \Stack\Three( new stdClass ); | ||
$two = new \Stack\Two( $three ); | ||
$one = new \Stack\One( $two ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_TRACING, XDEBUG_NAMESPACE_BLACKLIST, [ 'Stack\One' ] ); | ||
$one->callObj( 'callObj', 'error', 'Error triggered!' ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_TRACING, XDEBUG_NAMESPACE_BLACKLIST, [ '\Stack\One' ] ); | ||
$one->callObj( 'callObj', 'error', 'Error triggered!' ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_TRACING, XDEBUG_NAMESPACE_BLACKLIST, [ '\Stack\One', 'Stack\Two' ] ); | ||
$one->callObj( 'callObj', 'error', 'Error triggered!' ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_TRACING, XDEBUG_NAMESPACE_BLACKLIST, [ 'Stack\Two', 'Stack\Three' ] ); | ||
$one->callObj( 'callObj', 'error', 'Error triggered!' ); | ||
|
||
xdebug_set_filter(XDEBUG_FILTER_TRACING, XDEBUG_NAMESPACE_BLACKLIST, [ '', 'Stack\Two' ] ); | ||
$one->callObj( 'callObj', 'error', 'Error triggered!' ); | ||
?> | ||
--EXPECTF-- | ||
Warning: Error triggered! in %sthree.php on line 18 | ||
|
||
Call Stack: | ||
%w%f %w%d 1. {main}() %sstack-filter-ns-black-1.php:0 | ||
%w%f %w%d 3. Stack\Two->callObj($name = 'error', ...$arguments = variadic('Error triggered!')) %sone.php:13 | ||
%w%f %w%d 4. Stack\Three->error($value = 'Error triggered!') %stwo.php:13 | ||
%w%f %w%d 5. trigger_error('Error triggered!', 512) %sthree.php:18 | ||
|
||
|
||
Warning: Error triggered! in %sthree.php on line 18 | ||
|
||
Call Stack: | ||
%w%f %w%d 1. {main}() %sstack-filter-ns-black-1.php:0 | ||
%w%f %w%d 3. Stack\Two->callObj($name = 'error', ...$arguments = variadic('Error triggered!')) %sone.php:13 | ||
%w%f %w%d 4. Stack\Three->error($value = 'Error triggered!') %stwo.php:13 | ||
%w%f %w%d 5. trigger_error('Error triggered!', 512) %sthree.php:18 | ||
|
||
|
||
Warning: Error triggered! in %sthree.php on line 18 | ||
|
||
Call Stack: | ||
%w%f %w%d 1. {main}() %sstack-filter-ns-black-1.php:0 | ||
%w%f %w%d 4. Stack\Three->error($value = 'Error triggered!') %stwo.php:13 | ||
%w%f %w%d 5. trigger_error('Error triggered!', 512) %sthree.php:18 | ||
|
||
|
||
Warning: Error triggered! in %sthree.php on line 18 | ||
|
||
Call Stack: | ||
%w%f %w%d 1. {main}() %sstack-filter-ns-black-1.php:0 | ||
%w%f %w%d 2. Stack\One->callObj($name = 'callObj', ...$arguments = variadic('error', 'Error triggered!')) %sstack-filter-ns-black-1.php:22 | ||
%w%f %w%d 5. trigger_error('Error triggered!', 512) %sthree.php:18 | ||
|
||
|
||
Warning: Error triggered! in %sthree.php on line 18 | ||
|
||
Call Stack: | ||
%w%f %w%d 1. {main}() %sstack-filter-ns-black-1.php:0 | ||
%w%f %w%d 2. Stack\One->callObj($name = 'callObj', ...$arguments = variadic('error', 'Error triggered!')) %sstack-filter-ns-black-1.php:25 | ||
%w%f %w%d 4. Stack\Three->error($value = 'Error triggered!') %stwo.php:13 |
Oops, something went wrong.