| Server IP : 54.233.248.239 / Your IP : 172.28.20.13 Web Server : Apache System : Linux ip-172-28-29-189 6.5.0-1014-aws #14~22.04.1-Ubuntu SMP Thu Feb 15 15:27:06 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.2.34-43+ubuntu22.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/vinumday2_0/vendor/nikic/php-parser/test/code/formatPreservation/ |
Upload File : |
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;