Skip to content

Commit

Permalink
Merge branch 'master' of github.com:xdebug/xdebug
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Feb 27, 2016
2 parents cf7af75 + f2973ac commit 79de788
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 3 deletions.
2 changes: 1 addition & 1 deletion php_xdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define PHP_XDEBUG_H

#define XDEBUG_NAME "Xdebug"
#define XDEBUG_VERSION "2.4.0RC4"
#define XDEBUG_VERSION "2.4.0RC5-dev"
#define XDEBUG_AUTHOR "Derick Rethans"
#define XDEBUG_COPYRIGHT "Copyright (c) 2002-2016 by Derick Rethans"
#define XDEBUG_COPYRIGHT_SHORT "Copyright (c) 2002-2016"
Expand Down
4 changes: 2 additions & 2 deletions template.rc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
# define THANKS_GUYS ""
#endif

#define VERSIONDESC 2,4,0,9
#define VERSIONSTR "2.4.0RC4"
#define VERSIONDESC 2,4,0,10
#define VERSIONSTR "2.4.0RC5-dev"

//Version
VS_VERSION_INFO VERSIONINFO
Expand Down
70 changes: 70 additions & 0 deletions tests/bug01258-php5.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
--TEST--
Test for bug #1258: ensure case statements are covered (< PHP 7.0)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.0", '<')) echo "skip < PHP 7.0 needed\n"; ?>
--FILE--
<?php
$foo = ['bar', 'baz', 'qux', 'quux'];
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
foreach ($foo as $k => $v) {
switch ($v) {
case 'bar':
echo "bar\n";
break;
case 'baz':
echo "baz\n";
break;
case 'qux':
echo "qux\n";
break;
default:
echo "default\n";
break;
}
}
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc);
?>
--EXPECTF--
bar
baz
qux
default
array(1) {
["%sbug01258-php5.php"]=>
array(16) {
[4]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[9]=>
int(1)
[10]=>
int(1)
[11]=>
int(1)
[12]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[15]=>
int(1)
[16]=>
int(1)
[17]=>
int(1)
[18]=>
int(1)
[19]=>
int(1)
[20]=>
int(1)
}
}
64 changes: 64 additions & 0 deletions tests/bug01258-php7.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
--TEST--
Test for bug #1258: ensure case statements are covered (>= PHP 7.0)
--SKIPIF--
<?php if (!version_compare(phpversion(), "7.0", '>=')) echo "skip PHP >= 7.0 needed\n"; ?>
--FILE--
<?php
$foo = ['bar', 'baz', 'qux', 'quux'];
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
foreach ($foo as $k => $v) {
switch ($v) {
case 'bar':
echo "bar\n";
break;
case 'baz':
echo "baz\n";
break;
case 'qux':
echo "qux\n";
break;
default:
echo "default\n";
break;
}
}
$cc = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
var_dump($cc);
?>
--EXPECTF--
bar
baz
qux
default
array(1) {
["%sbug01258-php7.php"]=>
array(13) {
[4]=>
int(1)
[6]=>
int(1)
[7]=>
int(1)
[8]=>
int(1)
[9]=>
int(1)
[10]=>
int(1)
[11]=>
int(1)
[12]=>
int(1)
[13]=>
int(1)
[14]=>
int(1)
[16]=>
int(1)
[17]=>
int(1)
[20]=>
int(1)
}
}
2 changes: 2 additions & 0 deletions xdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ PHP_MINIT_FUNCTION(xdebug)
#if PHP_VERSION_ID < 70000
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_SWITCH_FREE);
#endif
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_CASE);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_QM_ASSIGN);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DECLARE_LAMBDA_FUNCTION);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_ADD_TRAIT);
Expand Down Expand Up @@ -887,6 +888,7 @@ PHP_MSHUTDOWN_FUNCTION(xdebug)
#if PHP_VERSION_ID < 70000
zend_set_user_opcode_handler(ZEND_SWITCH_FREE, NULL);
#endif
zend_set_user_opcode_handler(ZEND_CASE, NULL);
zend_set_user_opcode_handler(ZEND_QM_ASSIGN, NULL);
zend_set_user_opcode_handler(ZEND_DECLARE_LAMBDA_FUNCTION, NULL);
zend_set_user_opcode_handler(ZEND_ADD_TRAIT, NULL);
Expand Down

0 comments on commit 79de788

Please sign in to comment.