Skip to content
Permalink
Browse files

Overload ZEND_BIND_LEXICAL due to changes in PHP 7.4 with opcache loaded

  • Loading branch information...
derickr committed Jun 10, 2019
1 parent 585dee1 commit 0ac9ac5a2ed1c964e9a7fd5b3fa2cc8243d1feb5
Showing with 40 additions and 4 deletions.
  1. +2 −4 tests/{bug01403.phpt → bug01403-php71.phpt}
  2. +36 −0 tests/bug01403-php74.phpt
  3. +2 −0 xdebug.c
@@ -1,11 +1,9 @@
--TEST--
Test for bug #1403: Code coverage does not cover BIND_STATIC (> PHP 7.1)
--XFAIL--
PHP bug #78132: PHP 7.4 and later don't associate right line number with BIND_STATIC
Test for bug #1403: Code coverage does not cover BIND_STATIC/BIND_LEXICAL (>= PHP 7.1, < PHP 7.4)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.1');
check_reqs('PHP >= 7.1,< 7.4');
?>
--INI--
xdebug.default_enable=1
@@ -0,0 +1,36 @@
--TEST--
Test for bug #1403: Code coverage does not cover BIND_STATIC/BIND_LEXICAL (>= PHP 7.4)
--SKIPIF--
<?php
require __DIR__ . '/utils.inc';
check_reqs('PHP >= 7.4');
?>
--INI--
xdebug.default_enable=1
xdebug.auto_trace=0
xdebug.auto_profile=0
xdebug.profiler_enable=0
xdebug.overload_var_dump=0
--FILE--
<?php
$file = 'bug01403.inc';
$pathname = stream_resolve_include_path($file);
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
require $pathname;
$coverage = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
print_r($coverage[$pathname]);
?>
--EXPECTF--
Array
(
[5] => 1
[6] => 1
[8] => 1
[11] => 1
[12] => 1
[13] => 1
[15] => 1
[16] => 1
[18] => 1
)
@@ -850,6 +850,7 @@ PHP_MINIT_FUNCTION(xdebug)
#if PHP_VERSION_ID >= 70100
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_GENERATOR_CREATE);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BIND_STATIC);
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_BIND_LEXICAL);
#endif
#if PHP_VERSION_ID >= 70400
XDEBUG_SET_OPCODE_OVERRIDE_COMMON(ZEND_DECLARE_CLASS);
@@ -1033,6 +1034,7 @@ PHP_MSHUTDOWN_FUNCTION(xdebug)
#if PHP_VERSION_ID >= 70100
zend_set_user_opcode_handler(ZEND_GENERATOR_CREATE, NULL);
zend_set_user_opcode_handler(ZEND_BIND_STATIC, NULL);
zend_set_user_opcode_handler(ZEND_BIND_LEXICAL, NULL);
#endif
#if PHP_VERSION_ID >= 70400
zend_set_user_opcode_handler(ZEND_DECLARE_CLASS, NULL);

0 comments on commit 0ac9ac5

Please sign in to comment.
You can’t perform that action at this time.