Arbit - project tracking

PHP Depend

#111: Dynamic Strings are treated as literals

Issue revisions

  • new by Manuel Pichler at 2010-J-15 22:13
  • assigned by Manuel Pichler at 2010-J-15 22:13
  • assigned by Manuel Pichler at 2010-J-15 22:13
  • closed by Manuel Pichler at 2010-J-27 21:09
Type bug bug
State closed closed
Priority medium medium
Resolution fixed fixed
Assigned to Manuel Pichler
Scheduled for 0.9.10
Affected versions 0.9.9, 0.9.x, 0.9.x-svn
Affected components Code, Parser
Last change Wednesday 27 January 2010 21:09:51 UTC by Manuel Pichler

Short description

PHP_Depend current Parser and AST implementation treats valid PHP strings with embedded expressions as simple string literals. This behavior results in false positives while performing static code analysis operations on the abstract syntax tree.

Steps to reproduce

$lastName = "Pichler"; $firstName = "Manuel";

$string = "{$firstName} {$lastName}";

Expected behavior

  • AssignmentExpression

    • ASTLiteral("Pichler")

    • ASTVariable($lastName)

  • AssignmentExpression

    • ASTLiteral("Manuel")

    • ASTVariable($firstName)

  • AssignmentExpression

    • ASTVariable($string)

    • ASTString

      • ASTLiteral(")

      • ASTVariable($firstName)

      • ASTLiteral( )

      • ASTVariable($lastName)

      • ASTLiteral(")

Actual behavior

  • AssignmentExpression

    • ASTLiteral("Pichler")

    • ASTVariable($lastName)

  • AssignmentExpression

    • ASTLiteral("Manuel")

    • ASTVariable($firstName)

  • AssignmentExpression

    • ASTVariable($string)

    • ASTLiteral("{$firstName} {$lastName}")

  • Manuel Pichler at Friday 15 January 2010 22:13:58 UTC

    Scheduled for version 0.9.10

  • Manuel Pichler at Wednesday 27 January 2010 21:09:51 UTC

    Fixed in svn revision #1037.