Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/php-static-scanner-instrumentalization.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-27 22:47:19 +0300
committerLukas Reschke <lukas@statuscode.ch>2016-12-27 22:47:19 +0300
commitc6f6f847f06eec80f6cfd29c5b7384b19468861a (patch)
tree211772ce18b59ee1968d4979ffdb373b3743a324
parent4951c18c0d6a46a680e64bb57c797c947b71197b (diff)
Run onyl when required
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r--src/Visitor/PublicFunctionVisitor.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Visitor/PublicFunctionVisitor.php b/src/Visitor/PublicFunctionVisitor.php
index 72c8dd3..22c2e59 100644
--- a/src/Visitor/PublicFunctionVisitor.php
+++ b/src/Visitor/PublicFunctionVisitor.php
@@ -74,14 +74,15 @@ class PublicFunctionVisitor extends NodeVisitorAbstract {
if($className === 'JSONResponse') {
$args = new Node\Arg(new Node\Expr\FuncCall(new Node\Name('json_encode'), $newNode->args));
$node->stmts[$key] = new Node\Stmt\Echo_([$args]);
+
+ $arg = new Node\Arg(new Node\Scalar\String_('Content-Type:application/json; charset=utf-8'));
+ $header = new Node\Expr\FuncCall(new Node\Name('header'), [$arg]);
+ $node->stmts = $this->insertBeforeKey($node->stmts, $header, $key);
+ $arg = new Node\Arg(new Node\Scalar\String_('X-Content-Type-Options: nosniff'));
+ $header = new Node\Expr\FuncCall(new Node\Name('header'), [$arg]);
+ $node->stmts = $this->insertBeforeKey($node->stmts, $header, $key + 1);
}
- $arg = new Node\Arg(new Node\Scalar\String_('Content-Type:application/json; charset=utf-8'));
- $header = new Node\Expr\FuncCall(new Node\Name('header'), [$arg]);
- $node->stmts = $this->insertBeforeKey($node->stmts, $header, $key);
- $arg = new Node\Arg(new Node\Scalar\String_('X-Content-Type-Options: nosniff'));
- $header = new Node\Expr\FuncCall(new Node\Name('header'), [$arg]);
- $node->stmts = $this->insertBeforeKey($node->stmts, $header, $key + 1);
}
}