Skip to content
Permalink
Browse files

Fixed issue #1683: Xdebug does not compile due to changes to ASSIGN_A…

…DD and friends operations in PHP 7.4alpha3
  • Loading branch information...
derickr committed Jul 11, 2019
1 parent 1c22ec0 commit ff34ac1aa3b3c3329de79622d3acdebc3bc60c8b
@@ -0,0 +1,51 @@
--TEST--
Test for tracing array assign ops
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a['foo'][3]['test'] = 0;
$a['foo'][3]['test'] += 42;
$a['foo'][3]['test'] -= 2;
$a['foo'][3]['test'] *= 2;
$a['foo'][3]['test'] /= 5;
$a['foo'][3]['test'] %= 4;
$a['foo'][3]['test'] <<= 1;
$a['foo'][3]['test'] >>= 3;
$a['foo'][3]['test'] |= 0xffff;
$a['foo'][3]['test'] &= 0xff0f;
$a['foo'][3]['test'] ^= 0xf00f;
$a['foo'][3]['test'] **= 2;
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-dim-op.php:2
=> $a['foo'][3]['test'] = 0 %sassignment-trace-dim-op.php:4
=> $a['foo'][3]['test'] += 42 %sassignment-trace-dim-op.php:6
=> $a['foo'][3]['test'] -= 2 %sassignment-trace-dim-op.php:7
=> $a['foo'][3]['test'] *= 2 %sassignment-trace-dim-op.php:8
=> $a['foo'][3]['test'] /= 5 %sassignment-trace-dim-op.php:9
=> $a['foo'][3]['test'] %= 4 %sassignment-trace-dim-op.php:10
=> $a['foo'][3]['test'] <<= 1 %sassignment-trace-dim-op.php:11
=> $a['foo'][3]['test'] >>= 3 %sassignment-trace-dim-op.php:12
=> $a['foo'][3]['test'] |= 65535 %sassignment-trace-dim-op.php:13
=> $a['foo'][3]['test'] &= 65295 %sassignment-trace-dim-op.php:14
=> $a['foo'][3]['test'] ^= 61455 %sassignment-trace-dim-op.php:15
=> $a['foo'][3]['test'] **= 2 %sassignment-trace-dim-op.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-dim-op.php:18
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -0,0 +1,52 @@
--TEST--
Test for tracing property assign ops [1]
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a = new stdClass;
$a->test = 0;
$a->test += 42;
$a->test -= 2;
$a->test *= 2;
$a->test /= 5;
$a->test %= 4;
$a->test <<= 1;
$a->test >>= 3;
$a->test |= 0xffff;
$a->test &= 0xff0f;
$a->test ^= 0xf00f;
$a->test **= 2;
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-obj-op-001.php:2
=> $a = class stdClass { } %sassignment-trace-obj-op-001.php:4
=> $a->test = 0 %sassignment-trace-obj-op-001.php:5
=> $a->test += 42 %sassignment-trace-obj-op-001.php:6
=> $a->test -= 2 %sassignment-trace-obj-op-001.php:7
=> $a->test *= 2 %sassignment-trace-obj-op-001.php:8
=> $a->test /= 5 %sassignment-trace-obj-op-001.php:9
=> $a->test %= 4 %sassignment-trace-obj-op-001.php:10
=> $a->test <<= 1 %sassignment-trace-obj-op-001.php:11
=> $a->test >>= 3 %sassignment-trace-obj-op-001.php:12
=> $a->test |= 65535 %sassignment-trace-obj-op-001.php:13
=> $a->test &= 65295 %sassignment-trace-obj-op-001.php:14
=> $a->test ^= 61455 %sassignment-trace-obj-op-001.php:15
=> $a->test **= 2 %sassignment-trace-obj-op-001.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-obj-op-001.php:18
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -0,0 +1,52 @@
--TEST--
Test for tracing property assign ops [2]
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a = new stdClass;
$a->test = ['foo' => 0];
$a->test['foo'] += 42;
$a->test['foo'] -= 2;
$a->test['foo'] *= 2;
$a->test['foo'] /= 5;
$a->test['foo'] %= 4;
$a->test['foo'] <<= 1;
$a->test['foo'] >>= 3;
$a->test['foo'] |= 0xffff;
$a->test['foo'] &= 0xff0f;
$a->test['foo'] ^= 0xf00f;
$a->test['foo'] **= 2;
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-obj-op-002.php:2
=> $a = class stdClass { } %sassignment-trace-obj-op-002.php:4
=> $a->test = array ('foo' => 0) %sassignment-trace-obj-op-002.php:5
=> $a->test['foo'] += 42 %sassignment-trace-obj-op-002.php:6
=> $a->test['foo'] -= 2 %sassignment-trace-obj-op-002.php:7
=> $a->test['foo'] *= 2 %sassignment-trace-obj-op-002.php:8
=> $a->test['foo'] /= 5 %sassignment-trace-obj-op-002.php:9
=> $a->test['foo'] %= 4 %sassignment-trace-obj-op-002.php:10
=> $a->test['foo'] <<= 1 %sassignment-trace-obj-op-002.php:11
=> $a->test['foo'] >>= 3 %sassignment-trace-obj-op-002.php:12
=> $a->test['foo'] |= 65535 %sassignment-trace-obj-op-002.php:13
=> $a->test['foo'] &= 65295 %sassignment-trace-obj-op-002.php:14
=> $a->test['foo'] ^= 61455 %sassignment-trace-obj-op-002.php:15
=> $a->test['foo'] **= 2 %sassignment-trace-obj-op-002.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-obj-op-002.php:18
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -0,0 +1,52 @@
--TEST--
Test for tracing property assign ops [3]
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a = ['foo' => new stdClass];
$a['foo']->test = 0;
$a['foo']->test += 42;
$a['foo']->test -= 2;
$a['foo']->test *= 2;
$a['foo']->test /= 5;
$a['foo']->test %= 4;
$a['foo']->test <<= 1;
$a['foo']->test >>= 3;
$a['foo']->test |= 0xffff;
$a['foo']->test &= 0xff0f;
$a['foo']->test ^= 0xf00f;
$a['foo']->test **= 2;
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-obj-op-003.php:2
=> $a = array ('foo' => class stdClass { }) %sassignment-trace-obj-op-003.php:4
=> $a['foo']->test = 0 %sassignment-trace-obj-op-003.php:5
=> $a['foo']->test += 42 %sassignment-trace-obj-op-003.php:6
=> $a['foo']->test -= 2 %sassignment-trace-obj-op-003.php:7
=> $a['foo']->test *= 2 %sassignment-trace-obj-op-003.php:8
=> $a['foo']->test /= 5 %sassignment-trace-obj-op-003.php:9
=> $a['foo']->test %= 4 %sassignment-trace-obj-op-003.php:10
=> $a['foo']->test <<= 1 %sassignment-trace-obj-op-003.php:11
=> $a['foo']->test >>= 3 %sassignment-trace-obj-op-003.php:12
=> $a['foo']->test |= 65535 %sassignment-trace-obj-op-003.php:13
=> $a['foo']->test &= 65295 %sassignment-trace-obj-op-003.php:14
=> $a['foo']->test ^= 61455 %sassignment-trace-obj-op-003.php:15
=> $a['foo']->test **= 2 %sassignment-trace-obj-op-003.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-obj-op-003.php:18
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -0,0 +1,51 @@
--TEST--
Test for tracing assign ops
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a = 0;
$a += 42;
$a -= 2;
$a *= 2;
$a /= 5;
$a %= 4;
$a <<= 1;
$a >>= 3;
$a |= 0xffff;
$a &= 0xff0f;
$a ^= 0xf00f;
$a **= 2;
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-op.php:2
=> $a = 0 %sassignment-trace-op.php:4
=> $a += 42 %sassignment-trace-op.php:6
=> $a -= 2 %sassignment-trace-op.php:7
=> $a *= 2 %sassignment-trace-op.php:8
=> $a /= 5 %sassignment-trace-op.php:9
=> $a %= 4 %sassignment-trace-op.php:10
=> $a <<= 1 %sassignment-trace-op.php:11
=> $a >>= 3 %sassignment-trace-op.php:12
=> $a |= 65535 %sassignment-trace-op.php:13
=> $a &= 65295 %sassignment-trace-op.php:14
=> $a ^= 61455 %sassignment-trace-op.php:15
=> $a **= 2 %sassignment-trace-op.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-op.php:18
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -0,0 +1,56 @@
--TEST--
Test for tracing $static-prop property assign ops [1]
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a = new test;
class test { static $test; function assign() {
self::$test = 0;
self::$test += 42;
self::$test -= 2;
self::$test *= 2;
self::$test /= 5;
self::$test %= 4;
self::$test <<= 1;
self::$test >>= 3;
self::$test |= 0xffff;
self::$test &= 0xff0f;
self::$test ^= 0xf00f;
self::$test **= 2;
} }
$a->assign();
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-static-prop-op-001.php:2
=> $a = class test { } %sassignment-trace-static-prop-op-001.php:3
%w%f %w%d -> test->assign() %sassignment-trace-static-prop-op-001.php:19
=> self::test = 0 %sassignment-trace-static-prop-op-001.php:5
=> self::test += 42 %sassignment-trace-static-prop-op-001.php:6
=> self::test -= 2 %sassignment-trace-static-prop-op-001.php:7
=> self::test *= 2 %sassignment-trace-static-prop-op-001.php:8
=> self::test /= 5 %sassignment-trace-static-prop-op-001.php:9
=> self::test %= 4 %sassignment-trace-static-prop-op-001.php:10
=> self::test <<= 1 %sassignment-trace-static-prop-op-001.php:11
=> self::test >>= 3 %sassignment-trace-static-prop-op-001.php:12
=> self::test |= 65535 %sassignment-trace-static-prop-op-001.php:13
=> self::test &= 65295 %sassignment-trace-static-prop-op-001.php:14
=> self::test ^= 61455 %sassignment-trace-static-prop-op-001.php:15
=> self::test **= 2 %sassignment-trace-static-prop-op-001.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-static-prop-op-001.php:21
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]
@@ -0,0 +1,57 @@
--TEST--
Test for tracing $static-prop property assign ops [2]
--INI--
xdebug.default_enable=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.trace_format=0
xdebug.collect_vars=1
xdebug.collect_params=4
xdebug.collect_return=0
xdebug.collect_assignments=1
--FILE--
<?php
$tf = xdebug_start_trace(sys_get_temp_dir() . '/'. uniqid('xdt', TRUE));
$a = new test;
class test { static $test; function assign() { self::$test = ['foo' => 0];
self::$test['foo'] = 0;
self::$test['foo'] += 42;
self::$test['foo'] -= 2;
self::$test['foo'] *= 2;
self::$test['foo'] /= 5;
self::$test['foo'] %= 4;
self::$test['foo'] <<= 1;
self::$test['foo'] >>= 3;
self::$test['foo'] |= 0xffff;
self::$test['foo'] &= 0xff0f;
self::$test['foo'] ^= 0xf00f;
self::$test['foo'] **= 2;
} }
$a->assign();
xdebug_stop_trace();
echo file_get_contents($tf);
unlink($tf);
?>
--EXPECTF--
TRACE START [%d-%d-%d %d:%d:%d]
=> $tf = '%s.xt' %sassignment-trace-static-prop-op-002.php:2
=> $a = class test { } %sassignment-trace-static-prop-op-002.php:3
%w%f %w%d -> test->assign() %sassignment-trace-static-prop-op-002.php:19
=> self::test = array ('foo' => 0) %sassignment-trace-static-prop-op-002.php:4
=> self::test['foo'] = 0 %sassignment-trace-static-prop-op-002.php:5
=> self::test['foo'] += 42 %sassignment-trace-static-prop-op-002.php:6
=> self::test['foo'] -= 2 %sassignment-trace-static-prop-op-002.php:7
=> self::test['foo'] *= 2 %sassignment-trace-static-prop-op-002.php:8
=> self::test['foo'] /= 5 %sassignment-trace-static-prop-op-002.php:9
=> self::test['foo'] %= 4 %sassignment-trace-static-prop-op-002.php:10
=> self::test['foo'] <<= 1 %sassignment-trace-static-prop-op-002.php:11
=> self::test['foo'] >>= 3 %sassignment-trace-static-prop-op-002.php:12
=> self::test['foo'] |= 65535 %sassignment-trace-static-prop-op-002.php:13
=> self::test['foo'] &= 65295 %sassignment-trace-static-prop-op-002.php:14
=> self::test['foo'] ^= 61455 %sassignment-trace-static-prop-op-002.php:15
=> self::test['foo'] **= 2 %sassignment-trace-static-prop-op-002.php:16
%w%f %w%d -> xdebug_stop_trace() %sassignment-trace-static-prop-op-002.php:21
%w%f %w%d
TRACE END [%d-%d-%d %d:%d:%d]

0 comments on commit ff34ac1

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