what is the best way to test for parse errors?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lkrubner@geocities.com

    what is the best way to test for parse errors?


    I'm thinking I'll write a script that loops through all the PHP files
    in a folder and does two tests, first to see if a file is there and
    then to see if it can be included(). If file_exists() is true and
    included() is false, there is probably a parse error in that file. I'll
    then have the script spit out a warning for me.

    Does anyone have a better idea than this?

  • NC

    #2
    Re: what is the best way to test for parse errors?

    lkrubner@geocit ies.com wrote:[color=blue]
    >
    > I'm thinking I'll write a script that loops through all the PHP files
    > in a folder and does two tests, first to see if a file is there and
    > then to see if it can be included(). If file_exists() is true and
    > included() is false, there is probably a parse error in that file.
    > I'll then have the script spit out a warning for me.[/color]

    Inclusion can produce variable name collisions...
    [color=blue]
    > Does anyone have a better idea than this?[/color]

    You can call the command-line interpreter with the -l key. This
    option tells the interpreter not to execute the script, but only
    to check its syntax.

    If the script is not found, the interpreter will return:

    Could not open input file: script.php.

    If the script is found and syntax check is sucessful, the
    interpreter will return:

    No syntax errors detected in scrip.php

    If the interpreter's response is something other than those
    two, there's a syntax error.

    Cheers,
    NC

    Comment

    Working...