Skip to content

invalid ast for silent #355

@alexander-akait

Description

@alexander-akait

Input:

<?php

echo '<select name="foo"><option value="bar"' . (@$_GET['foo'] === 'bar' ? ' 
 selected="selected"' : '') . '>bar</option></select>';

Expected: the silent node should be as left property of bin, now silent under retif

php parser output (https://github.com/nikic/PHP-Parser):

array(
    0: Stmt_Echo(
        exprs: array(
            0: Expr_BinaryOp_Concat(
                left: Expr_BinaryOp_Concat(
                    left: Scalar_String(
                        value: <select name="foo"><option value="bar"
                    )
                    right: Expr_Ternary(
                        cond: Expr_BinaryOp_Identical(
                            left: Expr_ErrorSuppress(
                                expr: Expr_ArrayDimFetch(
                                    var: Expr_Variable(
                                        name: _GET
                                    )
                                    dim: Scalar_String(
                                        value: foo
                                    )
                                )
                            )
                            right: Scalar_String(
                                value: bar
                            )
                        )
                        if: Scalar_String(
                            value:  
                         selected="selected"
                        )
                        else: Scalar_String(
                            value: 
                        )
                    )
                )
                right: Scalar_String(
                    value: >bar</option></select>
                )
            )
        )
    )
)

Expr_ErrorSuppress === silent

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions