This is a discussion on Tool to parse and validate PHP script? within the PHP Language forums, part of the PHP Programming Forums category; Hello Is there a tool on Linux/FreeBSD that can parse a PHP script to make sure there's no ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello
Is there a tool on Linux/FreeBSD that can parse a PHP script to make sure there's no compile-time issues? I just noticed that I copy/pasted some code that had lines longer that can fit in the SSH terminal window, and that caused a run-time error as reported in the /var/log/httpd-error.log but not in the browser: [error] PHP Notice: Undefined index: etablissemen\nt in /usr/local/www/apache22/data/prospect.php on line 49, referer: http://server/myscript.php Thank you. |
|
|||
|
Gilles Ganault wrote:
> Is there a tool on Linux/FreeBSD that can parse a PHP script to make > sure there's no compile-time issues? > > I just noticed that I copy/pasted some code that had lines longer that > can fit in the SSH terminal window, and that caused a run-time error > as reported in the /var/log/httpd-error.log but not in the browser: > > [error] PHP Notice: Undefined index: etablissemen\nt in > /usr/local/www/apache22/data/prospect.php on line 49, referer: > http://server/myscript.php You can run 'php -l thescript.php' to do a syntax check, however your error would not be catched by that: this is a run time error, and only catchable by actually running the script. Of course, on live websites error should not be shown, but logged, as is done her apparently. -- Rik Wasmus |
|
|||
|
On May 8, 9:06 am, Rik Wasmus <luiheidsgoe...@hotmail.com> wrote:
> Gilles Ganault wrote: > > Is there a tool on Linux/FreeBSD that can parse a PHP script to make > > sure there's no compile-time issues? > > > I just noticed that I copy/pasted some code that had lines longer that > > can fit in the SSH terminal window, and that caused a run-time error > > as reported in the /var/log/httpd-error.log but not in the browser: > > > [error] PHP Notice: Undefined index: etablissemen\nt in > > /usr/local/www/apache22/data/prospect.php on line 49, referer: > >http://server/myscript.php > > You can run 'php -l thescript.php' to do a syntax check, however your > error would not be catched by that: this is a run time error, and only > catchable by actually running the script. > > Of course, on live websites error should not be shown, but logged, as is > done her apparently. > -- > Rik Wasmus Any chance to transfer your file by ftp or sftp? |
|
|||
|
On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp wrote:
>> Gilles Ganault wrote: >> > Is there a tool on Linux/FreeBSD that can parse a PHP script to make >> > sure there's no compile-time issues? >> >> > I just noticed that I copy/pasted some code that had lines longer that >> > can fit in the SSH terminal window, and that caused a run-time error >> > as reported in the /var/log/httpd-error.log but not in the browser: >> >> > [error] PHP Notice: Undefined index: etablissemen\nt in >> > /usr/local/www/apache22/data/prospect.php on line 49, referer: >> >http://server/myscript.php >> > > Any chance to transfer your file by ftp or sftp? Or use a better configuration on the editor.... -- This was, apparently, beyond her ken. So far beyond her ken that she was well into barbie territory. -- J. D. Baldwin |
|
|||
|
ELINTPimp wrote:
> On May 8, 9:06 am, Rik Wasmus <luiheidsgoe...@hotmail.com> wrote: >> Gilles Ganault wrote: >>> Is there a tool on Linux/FreeBSD that can parse a PHP script to make >>> sure there's no compile-time issues? >>> I just noticed that I copy/pasted some code that had lines longer that >>> can fit in the SSH terminal window, and that caused a run-time error >>> as reported in the /var/log/httpd-error.log but not in the browser: >>> [error] PHP Notice: Undefined index: etablissemen\nt in >>> /usr/local/www/apache22/data/prospect.php on line 49, referer: >>> http://server/myscript.php >> You can run 'php -l thescript.php' to do a syntax check, however your >> error would not be catched by that: this is a run time error, and only >> catchable by actually running the script. >> >> Of course, on live websites error should not be shown, but logged, as is >> done her apparently. > > Any chance to transfer your file by ftp or sftp? What do you mean? 'my file'? -- Rik Wasmus |
|
|||
|
On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp <smsiebe@gmail.com>
wrote: >Any chance to transfer your file by ftp or sftp? I could do that instead. I'll just have to remember to convert from CRLF to CR. Thanks for the "-l" switch. |
|
|||
|
On May 8, 9:59 am, Rik Wasmus <luiheidsgoe...@hotmail.com> wrote:
> ELINTPimp wrote: > > On May 8, 9:06 am, Rik Wasmus <luiheidsgoe...@hotmail.com> wrote: > >> Gilles Ganault wrote: > >>> Is there a tool on Linux/FreeBSD that can parse a PHP script to make > >>> sure there's no compile-time issues? > >>> I just noticed that I copy/pasted some code that had lines longer that > >>> can fit in the SSH terminal window, and that caused a run-time error > >>> as reported in the /var/log/httpd-error.log but not in the browser: > >>> [error] PHP Notice: Undefined index: etablissemen\nt in > >>> /usr/local/www/apache22/data/prospect.php on line 49, referer: > >>>http://server/myscript.php > >> You can run 'php -l thescript.php' to do a syntax check, however your > >> error would not be catched by that: this is a run time error, and only > >> catchable by actually running the script. > > >> Of course, on live websites error should not be shown, but logged, as is > >> done her apparently. > > > Any chance to transfer your file by ftp or sftp? > > What do you mean? 'my file'? > > -- > Rik Wasmus Sorry, Rik, I replied to the wrong comment. I was referring to the posters copy/paste method being the problem and skip the need for checking this post-transfer altogether by transferring the file they created (and presumably tested) instead of copy/paste over ssh. |
|
|||
|
Gilles Ganault wrote:
> On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp <smsiebe@gmail.com> > wrote: >> Any chance to transfer your file by ftp or sftp? > > I could do that instead. I'll just have to remember to convert from > CRLF to CR. I often work under Windows, however, even under Windows my editor is set up to \n instead of \r\n all the time. Saves a lot of headaches. -- Rik Wasmus |
|
|||
|
Rik Wasmus wrote:
> Gilles Ganault wrote: >> On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp <smsiebe@gmail.com> >> wrote: >>> Any chance to transfer your file by ftp or sftp? >> >> I could do that instead. I'll just have to remember to convert from >> CRLF to CR. > > I often work under Windows, however, even under Windows my editor is set > up to \n instead of \r\n all the time. Saves a lot of headaches. > A text mode transfer will automatically strip or add \r as necessary. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
Gilles Ganault wrote:
> Hello > > Is there a tool on Linux/FreeBSD that can parse a PHP script to make > sure there's no compile-time issues? You will never have a compile-time error with PHP since PHP is a script and, hence, doesn't compile. Perhaps you mean run-time issues? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|