Tool to parse and validate PHP script?

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 5 Days Ago
Gilles Ganault
 
Posts: n/a
Default Tool to parse and validate PHP script?

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.
Reply With Quote
  #2 (permalink)  
Old 5 Days Ago
Rik Wasmus
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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
Reply With Quote
  #3 (permalink)  
Old 5 Days Ago
ELINTPimp
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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?
Reply With Quote
  #4 (permalink)  
Old 5 Days Ago
Peter H. Coffin
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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
Reply With Quote
  #5 (permalink)  
Old 5 Days Ago
Rik Wasmus
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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
Reply With Quote
  #6 (permalink)  
Old 5 Days Ago
Gilles Ganault
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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.
Reply With Quote
  #7 (permalink)  
Old 5 Days Ago
ELINTPimp
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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.
Reply With Quote
  #8 (permalink)  
Old 5 Days Ago
Rik Wasmus
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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
Reply With Quote
  #9 (permalink)  
Old 5 Days Ago
Jerry Stuckle
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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
==================

Reply With Quote
  #10 (permalink)  
Old 5 Days Ago
sheldonlg
 
Posts: n/a
Default Re: Tool to parse and validate PHP script?

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?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:26 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0