xref: /php-src/sapi/phpdbg/tests/print_001.phpt (revision 97162e92)
1--TEST--
2Basic print functionality
3--INI--
4opcache.enable_cli=0
5--PHPDBG--
6p foo
7p class \Foo\bar
8p
9p e
10q
11--EXPECTF--
12[Successful compilation of %s]
13prompt> [User Function foo (8 ops)]
14
15foo:
16     ; (lines=8, args=1, vars=1, tmps=%d)
17     ; %s:14-16
18L0014 0000 CV0($baz) = RECV 1
19L0015 0001 INIT_FCALL %d %d string("var_dump")
20L0015 0002 INIT_FCALL %d %d string("strrev")
21L0015 0003 SEND_VAR CV0($baz) 1
22L0015 0004 V1 = DO_ICALL
23L0015 0005 SEND_VAR V1 1
24L0015 0006 DO_ICALL
25L0016 0007 RETURN null
26prompt> [User Class: Foo\Bar (2 methods)]
27
28Foo\Bar::Foo:
29     ; (lines=5, args=1, vars=1, tmps=%d)
30     ; %s:5-7
31L0005 0000 CV0($bar) = RECV 1
32L0006 0001 INIT_NS_FCALL_BY_NAME 1 string("Foo\\var_dump")
33L0006 0002 SEND_VAR_EX CV0($bar) 1
34L0006 0003 DO_FCALL
35L0007 0004 RETURN null
36
37Foo\Bar::baz:
38     ; (lines=1, args=0, vars=0, tmps=%d)
39     ; %s:9-9
40L0009 0000 RETURN null
41prompt> [Not Executing!]
42prompt> [Context %s (9 ops)]
43
44$_main:
45     ; (lines=9, args=0, vars=0, tmps=%d)
46     ; %s:1-21
47L0018 0000 V0 = NEW 0 string("Foo\\Bar")
48L0018 0001 DO_FCALL
49L0018 0002 INIT_METHOD_CALL 1 V0 string("Foo")
50L0018 0003 SEND_VAL_EX string("test \"quotes\"") 1
51L0018 0004 DO_FCALL
52L0019 0005 INIT_FCALL %d %d string("foo")
53L0019 0006 SEND_VAL string("test") 1
54L0019 0007 DO_FCALL
55L0021 0008 RETURN int(1)
56prompt>
57--FILE--
58<?php
59
60namespace Foo {
61	class Bar {
62		function Foo($bar) {
63			var_dump($bar);
64		}
65
66		function baz() { }
67	}
68}
69
70namespace {
71	function foo($baz) {
72		var_dump(strrev($baz));
73	}
74
75	(new \Foo\Bar)->Foo('test "quotes"');
76	foo("test");
77}
78