summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/tests
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg/tests')
-rw-r--r--sapi/phpdbg/tests/breakpoints_001.phpt22
-rw-r--r--sapi/phpdbg/tests/breakpoints_002.phpt28
-rw-r--r--sapi/phpdbg/tests/breakpoints_003.phpt14
-rw-r--r--sapi/phpdbg/tests/breakpoints_004.phpt28
-rw-r--r--sapi/phpdbg/tests/bug73794.phpt11
-rw-r--r--sapi/phpdbg/tests/exceptions_001.phpt6
-rw-r--r--sapi/phpdbg/tests/exceptions_003.phpt2
-rw-r--r--sapi/phpdbg/tests/finish_leave_001.phpt2
-rw-r--r--sapi/phpdbg/tests/stepping_001.phpt2
-rw-r--r--sapi/phpdbg/tests/watch_001.phpt6
-rw-r--r--sapi/phpdbg/tests/watch_002.phpt32
-rw-r--r--sapi/phpdbg/tests/watch_003.phpt39
-rw-r--r--sapi/phpdbg/tests/watch_004.phpt38
-rw-r--r--sapi/phpdbg/tests/watch_005.phpt48
-rw-r--r--sapi/phpdbg/tests/watch_006.phpt71
15 files changed, 298 insertions, 51 deletions
diff --git a/sapi/phpdbg/tests/breakpoints_001.phpt b/sapi/phpdbg/tests/breakpoints_001.phpt
index 934f0d3554..17e7c65cbf 100644
--- a/sapi/phpdbg/tests/breakpoints_001.phpt
+++ b/sapi/phpdbg/tests/breakpoints_001.phpt
@@ -11,23 +11,23 @@ q
[Successful compilation of %s]
prompt> [Breakpoint #0 added at %s:3]
prompt> [Breakpoint #0 at %s:3, hits: 1]
->00003: echo 1;
- 00004: echo 2;
- 00005: echo 3;
+>00003: echo $i++;
+ 00004: echo $i++;
+ 00005: echo $i++;
prompt> [Breakpoint #1 added at %s:4]
prompt> 1
[Breakpoint #1 at %s:4, hits: 1]
->00004: echo 2;
- 00005: echo 3;
- 00006: echo 4;
+>00004: echo $i++;
+ 00005: echo $i++;
+ 00006: echo $i++;
prompt> 234
[Script ended normally]
prompt>
--FILE--
<?php
-
-echo 1;
-echo 2;
-echo 3;
-echo 4;
+$i = 1;
+echo $i++;
+echo $i++;
+echo $i++;
+echo $i++;
diff --git a/sapi/phpdbg/tests/breakpoints_002.phpt b/sapi/phpdbg/tests/breakpoints_002.phpt
index 18aaef1f36..96c98194b1 100644
--- a/sapi/phpdbg/tests/breakpoints_002.phpt
+++ b/sapi/phpdbg/tests/breakpoints_002.phpt
@@ -14,27 +14,27 @@ q
prompt> [Breakpoint #0 added at %s:4]
prompt> 1
[Breakpoint #0 at %s:4, hits: 1]
->00004: echo 2;
- 00005: echo 3;
- 00006: echo 4;
+>00004: echo $i++;
+ 00005: echo $i++;
+ 00006: echo $i++;
prompt> [Breakpoint #1 added at %s:3]
prompt> Do you really want to restart execution? (type y or n): [Breakpoint #1 at %s:3, hits: 1]
->00003: echo 1;
- 00004: echo 2;
- 00005: echo 3;
+>00003: echo $i++;
+ 00004: echo $i++;
+ 00005: echo $i++;
prompt> 1
[Breakpoint #0 at %s:4, hits: 1]
->00004: echo 2;
- 00005: echo 3;
- 00006: echo 4;
+>00004: echo $i++;
+ 00005: echo $i++;
+ 00006: echo $i++;
prompt> 234
[Script ended normally]
prompt>
--FILE--
<?php
-
-echo 1;
-echo 2;
-echo 3;
-echo 4;
+$i = 1;
+echo $i++;
+echo $i++;
+echo $i++;
+echo $i++;
diff --git a/sapi/phpdbg/tests/breakpoints_003.phpt b/sapi/phpdbg/tests/breakpoints_003.phpt
index 8caa64632b..12b2504487 100644
--- a/sapi/phpdbg/tests/breakpoints_003.phpt
+++ b/sapi/phpdbg/tests/breakpoints_003.phpt
@@ -16,8 +16,8 @@ prompt> [Deleted breakpoint #0]
prompt> [Breakpoint #1 added at %s:5]
prompt> 12
[Breakpoint #1 at %s:5, hits: 1]
->00005: echo 3;
- 00006: echo 4;
+>00005: echo $i++;
+ 00006: echo $i++;
00007:
prompt> [Deleted breakpoint #1]
prompt> Do you really want to restart execution? (type y or n): 1234
@@ -25,9 +25,9 @@ prompt> Do you really want to restart execution? (type y or n): 1234
prompt>
--FILE--
<?php
-
-echo 1;
-echo 2;
-echo 3;
-echo 4;
+$i = 1;
+echo $i++;
+echo $i++;
+echo $i++;
+echo $i++;
diff --git a/sapi/phpdbg/tests/breakpoints_004.phpt b/sapi/phpdbg/tests/breakpoints_004.phpt
index 27ebd0bea2..917e908efb 100644
--- a/sapi/phpdbg/tests/breakpoints_004.phpt
+++ b/sapi/phpdbg/tests/breakpoints_004.phpt
@@ -12,30 +12,30 @@ q
[Successful compilation of %s]
prompt> [Breakpoint #0 added at ZEND_ECHO]
prompt> [Breakpoint #0 in ZEND_ECHO at %s:3, hits: 1]
->00003: echo 1;
- 00004: echo 2;
- 00005: echo 3;
+>00003: echo $i++;
+ 00004: echo $i++;
+ 00005: echo $i++;
prompt> 1
[Breakpoint #0 in ZEND_ECHO at %s:4, hits: 2]
->00004: echo 2;
- 00005: echo 3;
- 00006: echo 4;
+>00004: echo $i++;
+ 00005: echo $i++;
+ 00006: echo $i++;
prompt> 2
[Breakpoint #0 in ZEND_ECHO at %s:5, hits: 3]
->00005: echo 3;
- 00006: echo 4;
+>00005: echo $i++;
+ 00006: echo $i++;
00007:
prompt> 3
[Breakpoint #0 in ZEND_ECHO at %s:6, hits: 4]
->00006: echo 4;
+>00006: echo $i++;
00007:
prompt> 4
[Script ended normally]
prompt>
--FILE--
<?php
-
-echo 1;
-echo 2;
-echo 3;
-echo 4;
+$i = 1;
+echo $i++;
+echo $i++;
+echo $i++;
+echo $i++;
diff --git a/sapi/phpdbg/tests/bug73794.phpt b/sapi/phpdbg/tests/bug73794.phpt
new file mode 100644
index 0000000000..8d5ba234c7
--- /dev/null
+++ b/sapi/phpdbg/tests/bug73794.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #73794 (Crash (out of memory) when using run and # command separator)
+--PHPDBG--
+r echo # quit
+--EXPECTF--
+[Successful compilation of %s]
+prompt> echo
+--FILE--
+<?php
+echo $argv[1];
+?>
diff --git a/sapi/phpdbg/tests/exceptions_001.phpt b/sapi/phpdbg/tests/exceptions_001.phpt
index 991ea1cc71..99989654cf 100644
--- a/sapi/phpdbg/tests/exceptions_001.phpt
+++ b/sapi/phpdbg/tests/exceptions_001.phpt
@@ -14,12 +14,12 @@ prompt> handle first
00017: } catch (\Exception $e) {
00018: var_dump($e);
prompt> frame #0: {closure}() at %s:16
-frame #1: {main} at %s:20
+frame #1: {main} at %s:22
prompt> 3
prompt> [Uncaught Error in %s on line 16]
Error: Call to undefined function foo() in %s:16
Stack trace:
-#0 %s(20): {closure}()
+#0 %s(22): {closure}()
#1 {main}
[Script ended normally]
prompt>
@@ -42,5 +42,7 @@ prompt>
foo(); // Error
} catch (\Exception $e) {
var_dump($e);
+ } catch (\ParseError $e) {
+ var_dump($e);
}
})();
diff --git a/sapi/phpdbg/tests/exceptions_003.phpt b/sapi/phpdbg/tests/exceptions_003.phpt
index 988e0c2d06..51090c081a 100644
--- a/sapi/phpdbg/tests/exceptions_003.phpt
+++ b/sapi/phpdbg/tests/exceptions_003.phpt
@@ -25,7 +25,7 @@ prompt> [L7 %s ECHO "ok\n"
00008: }
00009: } catch (Error $e) {
prompt> ok
-[L7 %s FAST_RET<TO_CATCH> ~%d J7 %s]
+[L7 %s FAST_RET ~%d try-catch(0) %s]
[L9 %s CATCH "Error" $e 1 %s]
>00005: x();
00006: } finally {
diff --git a/sapi/phpdbg/tests/finish_leave_001.phpt b/sapi/phpdbg/tests/finish_leave_001.phpt
index 774776c05f..e345752b00 100644
--- a/sapi/phpdbg/tests/finish_leave_001.phpt
+++ b/sapi/phpdbg/tests/finish_leave_001.phpt
@@ -1,5 +1,7 @@
--TEST--
test finish and leave commands
+--INI--
+opcache.optimization_level=0
--PHPDBG--
b bar
b 5
diff --git a/sapi/phpdbg/tests/stepping_001.phpt b/sapi/phpdbg/tests/stepping_001.phpt
index 9c3429897b..76577b2767 100644
--- a/sapi/phpdbg/tests/stepping_001.phpt
+++ b/sapi/phpdbg/tests/stepping_001.phpt
@@ -1,5 +1,7 @@
--TEST--
Stepping with exceptions must not be stuck at CATCH
+--INI--
+opcache.enable=0
--PHPDBG--
b ZEND_THROW
r
diff --git a/sapi/phpdbg/tests/watch_001.phpt b/sapi/phpdbg/tests/watch_001.phpt
index ea7da1a87d..e16681bf7c 100644
--- a/sapi/phpdbg/tests/watch_001.phpt
+++ b/sapi/phpdbg/tests/watch_001.phpt
@@ -1,5 +1,7 @@
--TEST--
Test simple recursive watchpoint
+--INI--
+opcache.optimization_level=0
--PHPDBG--
b 3
r
@@ -16,7 +18,7 @@ prompt> [Breakpoint #0 at %s:3, hits: 1]
>00003: $a = 1;
00004: $b = [$a];
00005:
-prompt> [Set recursive watchpoint on $b]
+prompt> [Added recursive watchpoint #0 for $b]
prompt> [Breaking on watchpoint $b]
Old value:
New value: Array ([0] => 1)
@@ -32,7 +34,7 @@ prompt> [Breaking on watchpoint $b]
Old value:
New value: 2
>00008:
-prompt> [$b was removed, removing watchpoint recursively]
+prompt> [$b has been removed, removing watchpoint recursively]
[Script ended normally]
prompt>
--FILE--
diff --git a/sapi/phpdbg/tests/watch_002.phpt b/sapi/phpdbg/tests/watch_002.phpt
new file mode 100644
index 0000000000..b57ca0a1d4
--- /dev/null
+++ b/sapi/phpdbg/tests/watch_002.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test simple array watchpoint with replace
+--PHPDBG--
+b 6
+r
+w a $a
+c
+
+q
+--EXPECTF--
+[Successful compilation of %s]
+prompt> [Breakpoint #0 added at %s:6]
+prompt> [Breakpoint #0 at %s:6, hits: 1]
+>00006: $a[0] = 2;
+ 00007:
+ 00008: $a = [0 => 3, 1 => 4];
+prompt> [Added watchpoint #0 for $a[]]
+prompt> [Breaking on watchpoint $a[]]
+1 elements were added to the array
+>00009:
+prompt> [$a[] has been removed, removing watchpoint]
+[Script ended normally]
+prompt>
+--FILE--
+<?php
+
+$a = [];
+
+$a[0] = 1;
+$a[0] = 2;
+
+$a = [0 => 3, 1 => 4];
diff --git a/sapi/phpdbg/tests/watch_003.phpt b/sapi/phpdbg/tests/watch_003.phpt
new file mode 100644
index 0000000000..08868aedc3
--- /dev/null
+++ b/sapi/phpdbg/tests/watch_003.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test simple watchpoint with replace
+--PHPDBG--
+b 6
+r
+w $a[0]
+c
+
+
+q
+--EXPECTF--
+[Successful compilation of %s]
+prompt> [Breakpoint #0 added at %s:6]
+prompt> [Breakpoint #0 at %s:6, hits: 1]
+>00006: $a[0] = 2;
+ 00007:
+ 00008: $a = [0 => 3, 1 => 4];
+prompt> [Added watchpoint #0 for $a[0]]
+prompt> [Breaking on watchpoint $a[0]]
+Old value: 1
+New value: 2
+>00008: $a = [0 => 3, 1 => 4];
+ 00009:
+prompt> [Breaking on watchpoint $a[0]]
+Old value: 2
+New value: 3
+>00009:
+prompt> [$a[0] has been removed, removing watchpoint]
+[Script ended normally]
+prompt>
+--FILE--
+<?php
+
+$a = [];
+
+$a[0] = 1;
+$a[0] = 2;
+
+$a = [0 => 3, 1 => 4];
diff --git a/sapi/phpdbg/tests/watch_004.phpt b/sapi/phpdbg/tests/watch_004.phpt
new file mode 100644
index 0000000000..878542937b
--- /dev/null
+++ b/sapi/phpdbg/tests/watch_004.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test detection of inline string manipulations on zval watch
+--INI--
+opcache.optimization_level=0
+--PHPDBG--
+b 3
+r
+w $a
+c
+
+
+q
+--EXPECTF--
+[Successful compilation of %s]
+prompt> [Breakpoint #0 added at %s:3]
+prompt> [Breakpoint #0 at %s:3, hits: 1]
+>00003: $b = "a";
+ 00004: $a = $b.$b;
+ 00005: $a[1] = "b";
+prompt> [Added watchpoint #0 for $a]
+prompt> [Breaking on watchpoint $a]
+Old value:
+New value: aa
+>00005: $a[1] = "b";
+ 00006:
+prompt> [Breaking on watchpoint $a]
+Old value: aa
+New value: ab
+>00006:
+prompt> [$a has been removed, removing watchpoint]
+[Script ended normally]
+prompt>
+--FILE--
+<?php
+
+$b = "a";
+$a = $b.$b;
+$a[1] = "b";
diff --git a/sapi/phpdbg/tests/watch_005.phpt b/sapi/phpdbg/tests/watch_005.phpt
new file mode 100644
index 0000000000..d6bae9d3f3
--- /dev/null
+++ b/sapi/phpdbg/tests/watch_005.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test proper watch comparisons when having multiple levels of indirection from a zval to its value
+--PHPDBG--
+b 3
+r
+w r $a
+c
+
+
+
+q
+--EXPECTF--
+[Successful compilation of %s]
+prompt> [Breakpoint #0 added at %s:3]
+prompt> [Breakpoint #0 at %s:3, hits: 1]
+>00003: $b = "a";
+ 00004: $a = $b.$b;
+ 00005: $c = &$a;
+prompt> [Added recursive watchpoint #0 for $a]
+prompt> [Breaking on watchpoint $a]
+Old value:
+New value: aa
+>00005: $c = &$a;
+ 00006: $a[1] = "b";
+ 00007:
+prompt> [Breaking on watchpoint $a]
+Old value inaccessible or destroyed
+New value (reference): aa
+>00006: $a[1] = "b";
+ 00007:
+ 00008: exit;
+prompt> [Breaking on watchpoint $a]
+Old value: aa
+New value: ab
+>00008: exit;
+ 00009:
+prompt> [$a has been removed, removing watchpoint recursively]
+[Script ended normally]
+prompt>
+--FILE--
+<?php
+
+$b = "a";
+$a = $b.$b;
+$c = &$a;
+$a[1] = "b";
+
+exit;
diff --git a/sapi/phpdbg/tests/watch_006.phpt b/sapi/phpdbg/tests/watch_006.phpt
new file mode 100644
index 0000000000..bf38b8eff1
--- /dev/null
+++ b/sapi/phpdbg/tests/watch_006.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test multiple watch elements pointing to the same watchpoint
+--PHPDBG--
+b 4
+r
+w $a[0]
+w r $b
+c
+
+
+
+
+
+
+q
+--EXPECTF--
+[Successful compilation of %s]
+prompt> [Breakpoint #0 added at %s:4]
+prompt> [Breakpoint #0 at %s:4, hits: 1]
+>00004: $a[0] = 1;
+ 00005: $b = &$a;
+ 00006: $a[0] = 2;
+prompt> [Added watchpoint #0 for $a[0]]
+prompt> [Added recursive watchpoint #1 for $b]
+prompt> [Breaking on watchpoint $a[0]]
+Old value: 0
+New value: 1
+>00005: $b = &$a;
+ 00006: $a[0] = 2;
+ 00007: $a[1] = 3;
+prompt> [Breaking on watchpoint $b]
+Old value:
+New value (reference): Array ([0] => 1)
+>00006: $a[0] = 2;
+ 00007: $a[1] = 3;
+ 00008: $c = [1];
+prompt> [Breaking on watchpoint $a[0]]
+Old value: 1
+New value: 2
+>00007: $a[1] = 3;
+ 00008: $c = [1];
+ 00009: $b = &$c;
+prompt> [Element 1 has been added to watchpoint]
+[Breaking on watchpoint $b[]]
+1 elements were added to the array
+>00008: $c = [1];
+ 00009: $b = &$c;
+ 00010:
+prompt> [Breaking on watchpoint $b]
+Old value inaccessible or destroyed
+New value (reference): Array ([0] => 2,[1] => 3)
+>00009: $b = &$c;
+ 00010:
+prompt> [Breaking on watchpoint $b]
+Old value inaccessible or destroyed
+New value (reference): Array ([0] => 1)
+>00010:
+prompt> [$b has been removed, removing watchpoint recursively]
+[$a[0] has been removed, removing watchpoint]
+[Script ended normally]
+prompt>
+--FILE--
+<?php
+
+$a = [0];
+$a[0] = 1;
+$b = &$a;
+$a[0] = 2;
+$a[1] = 3;
+$c = [1];
+$b = &$c;