Closed alpha-and-omega closed 5 years ago
Embedded html can also be splitted to small chunks and shuffled by goto's much better ...
Here is my solution to this problem:
diff --git a/include/classes/parser_extensions/my_node_visitor.php b/include/classes/parser_extensions/my_node_visitor.php
index 5ea27e8..e2206a2 100644
--- a/include/classes/parser_extensions/my_node_visitor.php
+++ b/include/classes/parser_extensions/my_node_visitor.php
@@ -93,6 +93,11 @@ class MyNodeVisitor extends PhpParser\NodeVisitorAbstract // all parsing a
$node_modified = false;
+ if ($node instanceof PhpParser\Node\Stmt\InlineHTML ) {
+ $node = new PhpParser\Node\Stmt\Echo_([new PhpParser\Node\Scalar\String_($node->value)]);
+ $node_modified = true;
+ }
+
if ($node instanceof PhpParser\Node\Stmt\Class_) $this->current_class_name = null;
if ($node instanceof PhpParser\Node\Stmt\ClassConst) $this->is_in_class_const_definition = false;
Please integrate it without pull request. New config option probably should be added too.
I think it is a good idea. I do not have time to look further now and investigate on all possible side effects. The current version is a port of the legacy one using PHP-Parser 1.0 … the new PHP-Parser 4.x has a new syntax tree that certainly offers new possibilities... I think I will have more time in september… please wait a little.
done... thanx
Hello. I have seen this:
How about converting embedded html to echo << END .. END syntax before obfuscation ? PHP-Parser can help with it ?