Arbit - project tracking

PHP Depend

#150: Source is messed up in some case and not analzyed

Issue attachments

Issue revisions

  • new by Jürgen Henge-Ernst at 2010-M-06 11:00
  • new by Jürgen Henge-Ernst at 2010-M-06 11:00
  • assigned by Manuel Pichler at 2010-M-06 12:51
  • assigned by Manuel Pichler at 2010-M-06 13:10
  • assigned by Manuel Pichler at 2010-M-07 15:38
  • closed by Manuel Pichler at 2010-M-07 15:39
Type bug bug
State closed closed
Priority urgent urgent
Resolution fixed fixed
Assigned to Manuel Pichler
Scheduled for 0.9.13
Affected versions 0.9.12
Affected components Tokenizer
Last change Friday 7 May 2010 15:39:20 UTC by Manuel Pichler

Short description

Analyzing the attached file is not possible and internal the php source code analyzed is messed up due the php-shorttag handling which removes some chars. I suspect the regexp (<<<(s*)["']([^"']+)["']) that messes up with my code.

Steps to reproduce

phpmd x.php xml unusedcode

Expected behavior

<?xml version="1.0" encoding="UTF-8" ?> <pmd version="0.2.5" timestamp="2010-05-06T12:59:31+02:00"> </pmd>

Actual behavior

Unexpected character in input: ''' (ASCII=39) state=1

  • Jürgen Henge-Ernst at Thursday 6 May 2010 11:14:39 UTC

    Changing the regex in PHP/Depend/Tokenizer/Internal.php to: (<<<(s*)["']([^"'n]+)["']) seems to fix the issue

  • Manuel Pichler at Thursday 6 May 2010 13:10:46 UTC

    Scheduled for release 0.9.13

  • Jürgen Henge-Ernst at Thursday 6 May 2010 21:40:45 UTC

    Maybe it also work for \w+ and additional using recursion in the regexp so the regexp looks like:
    
    >>>
    (<<<(s*)(["'])(\w+)\2)
    and the replacement is
    <<<\1\3
  • Manuel Pichler at Friday 7 May 2010 12:20:51 UTC

    Hi Jürgen,

    thanks for reporting this issue and providing the patch. I will fix this asap.

  • Manuel Pichler at Friday 7 May 2010 15:38:12 UTC

    Fixed in svn revision #1266

  • Manuel Pichler at Friday 7 May 2010 15:39:20 UTC

    Forgot to change the ticket status. Fixed in svn revision #1266