[clug] CVS commitinfo check php syntax

Joel Pearson pearj at writeme.com
Thu Jun 3 13:46:39 GMT 2004


Hi,

On a phpcruise I went on earlier in the year someone mentioned that the
syntax of php could be checked on a cvs commit, so that obviously broken php
code doesn't make it into cvs.  I fiddled for quite a while but I can't make
it work.

Here is my commitinfo:
^.*\.php$ /usr/local/sbin/phpsyntax

and /usr/local/sbin/phpsyntax:
#/bin/bash
shift
while test "$1" != ""
        do
        FILENAME=$1
        /usr/bin/php -l $1 2&> /dev/null
        if [ $? -ne 0]; then
                return 1
        shift
        fi
        done
return 0

But for whatever reason the script doesn't run or doesn't work, I'm not sure
which one, caus I have no idea if there is a log that is hiding somewhere
that would explain why it doesn't work.  But I have a sneaking suspicion
that the phpsyntax script isn't running, or even if it is, it's written
badly.  I'm happy to accept either :-).

So can anyone offer me some tips ?

Thanks

-Joel





More information about the linux mailing list