1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
abc1
-----
<?php
echo
1
+
2
+
3;
-----
$stmts[0]->exprs[0]->left->right->value = 42;
-----
<?php
echo
1
+
42
+
3;
-----
<?php
function foo($a)
{ return $a; }
-----
$stmts[0]->name = new Node\Identifier('bar');
-----
<?php
function bar($a)
{ return $a; }
-----
<?php
function
foo() {
call(
$bar
);
}
-----
// This triggers a fallback
$stmts[0]->byRef = true;
-----
<?php
function &foo()
{
call(
$bar
);
}
-----
<?php
function
foo() {
echo "Start
End";
}
-----
// This triggers a fallback
$stmts[0]->byRef = true;
-----
<?php
function &foo()
{
echo "Start
End";
}
-----
<?php
function test() {
call1(
$bar
);
}
call2(
$foo
);
-----
$tmp = $stmts[0]->stmts[0];
$stmts[0]->stmts[0] = $stmts[1];
$stmts[1] = $tmp;
-----
<?php
function test() {
call2(
$foo
);
}
call1(
$bar
);
-----
<?php
x;
function test() {
call1(
$bar
);
}
call2(
$foo
);
-----
$tmp = $stmts[1]->stmts[0];
$stmts[1]->stmts[0] = $stmts[2];
$stmts[2] = $tmp;
// Same test, but also removing first statement, triggering fallback
array_splice($stmts, 0, 1, []);
-----
<?php
function test() {
call2(
$foo
);
}
call1(
$bar
);
-----
<?php
echo 1;
-----
$stmts[0] = new Stmt\Expression(
new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b')));
-----
<?php
$a = $b;
-----
<?php
echo$a;
-----
$stmts[0]->exprs[0] = new Expr\ConstFetch(new Node\Name('C'));
-----
<?php
echo C;
-----
<?php
function foo() {
foo();
/*
* bar
*/
baz();
}
{
$x;
}
-----
$tmp = $stmts[0];
$stmts[0] = $stmts[1];
$stmts[1] = $tmp;
/* TODO This used to do two replacement operations, but with the node list diffing this is a
* remove, keep, add (which probably makes more sense). As such, this currently triggers a
* fallback. */
-----
<?php
{
$x;
}
function foo() {
foo();
/*
* bar
*/
baz();
}
-----
<?php
echo "${foo}bar";
echo "${foo['baz']}bar";
-----
$stmts[0]->exprs[0]->parts[0] = new Expr\Variable('bar');
$stmts[1]->exprs[0]->parts[0] = new Expr\Variable('bar');
-----
<?php
echo "{$bar}bar";
echo "{$bar}bar";
-----
<?php
[$a
,$b
,
,] = $b;
-----
/* Nothing */
-----
<?php
[$a
,$b
,
,] = $b;
|