Rapid PHP - Could 'Syntax Check' give a clue to the problem?
Moderator: kfury77
Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
Please try to follow these guidelines. This will help to receive faster and more accurate response.
- Check the Support section of the corresponding product first. Chances are you will find your answer there;
- Do not create new topics for already reported problems. Add your comments to the existing topics instead;
- Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
- Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
- Include the version number of the software you are using;
- This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Rapid PHP - Could 'Syntax Check' give a clue to the problem?
Hi,
the Syntax Check in Rapid PHP is a great idea and works well within it's limitations, but wouldn't it be possible for it to actually give some kind of report or hint as to what / where the problem is?
It must have some internal data on what type of error exists, like unpaired brackets/braces/quotes even though a location cannot always be given with this type of problem, or only approximately, i.e. with a specific function definition.
With others, like missing the full stop when concatenating a literal string and variable ($string1 = 'text'$string2; in place of $string1 = 'text'.$string2;) the error is definitely a specific line - couldn't the cursor be left on the error line rather than always being taken back to the start of the file?
If you've only edited one or two lines it's not too bad, but when doing major edits or creating a large file from scratch it can take ages to localise a simple typo..
the Syntax Check in Rapid PHP is a great idea and works well within it's limitations, but wouldn't it be possible for it to actually give some kind of report or hint as to what / where the problem is?
It must have some internal data on what type of error exists, like unpaired brackets/braces/quotes even though a location cannot always be given with this type of problem, or only approximately, i.e. with a specific function definition.
With others, like missing the full stop when concatenating a literal string and variable ($string1 = 'text'$string2; in place of $string1 = 'text'.$string2;) the error is definitely a specific line - couldn't the cursor be left on the error line rather than always being taken back to the start of the file?
If you've only edited one or two lines it's not too bad, but when doing major edits or creating a large file from scratch it can take ages to localise a simple typo..
Robert Jenkins
- chrisjlocke
- Top Contributor
- Posts: 995
- Joined: Mon Aug 01, 2005 4:12 pm
- Location: Essex, UK
- Contact:
What version of PHP have you installed? I just typed your above code, and got WeBuilder to check it, and it reported back:
---------------------------
PHP Syntax Check
---------------------------
Parse error, unexpected T_VARIABLE in Document1 on line 3
---------------------------
OK
---------------------------
I've not used Rapid PHP, but it must use php.exe the same way. You can see it tells me what the error is, and where.
My version is 4.4.0.0 (right click on php.exe and select 'Properties', then the 'Version' tab)
---------------------------
PHP Syntax Check
---------------------------
Parse error, unexpected T_VARIABLE in Document1 on line 3
---------------------------
OK
---------------------------
I've not used Rapid PHP, but it must use php.exe the same way. You can see it tells me what the error is, and where.
My version is 4.4.0.0 (right click on php.exe and select 'Properties', then the 'Version' tab)
Doh..
I'd got version 5.1.4.4
With this it was just giving OK or NG.
I seem to remember updating while trying to get a previous editor to work with syntax checking..
Gone back to 4.4.2 and I am getting error info, though it's repeatedly giving 'Long line, iincrease buffer length' errors while doing the check.
I'd got version 5.1.4.4
With this it was just giving OK or NG.
I seem to remember updating while trying to get a previous editor to work with syntax checking..
Gone back to 4.4.2 and I am getting error info, though it's repeatedly giving 'Long line, iincrease buffer length' errors while doing the check.
Robert Jenkins
- chrisjlocke
- Top Contributor
- Posts: 995
- Joined: Mon Aug 01, 2005 4:12 pm
- Location: Essex, UK
- Contact:
The longest line is 124 characters in that particular file.
The error pops up about 12 times, there are only 8 lines over 80 characters.
The file is just an include with a few database functions, no HTML. The long lines are SQL queries.
As an experiment I tried php 4.3.9 & that again doesn't report error details.
All versions are being set up with the php.ini (-recommended) copied to c:\windows, the error log set to c:\temp\phperr.txt & the windows includes line uncommented.
I then re-select the php.exe file in Rapid PHP in case it needs to update anything.
Going back to 4.4.2 & it works again, with the 'long line' errors.
The error pops up about 12 times, there are only 8 lines over 80 characters.
The file is just an include with a few database functions, no HTML. The long lines are SQL queries.
As an experiment I tried php 4.3.9 & that again doesn't report error details.
All versions are being set up with the php.ini (-recommended) copied to c:\windows, the error log set to c:\temp\phperr.txt & the windows includes line uncommented.
I then re-select the php.exe file in Rapid PHP in case it needs to update anything.
Going back to 4.4.2 & it works again, with the 'long line' errors.
Robert Jenkins
- chrisjlocke
- Top Contributor
- Posts: 995
- Joined: Mon Aug 01, 2005 4:12 pm
- Location: Essex, UK
- Contact:
Interesting. I've just created this .php test file and ran a syntax check, and it passed. The longest single line there is 433 characters. However, this is in WeBuilder, although I'm sure the 'engine' is the same as Rapid PHP.
Does this test file barf for you too? (download (right click, save as) and rename to a .php file, obviously...)
http://www.creapsoft.co.uk/download?id=44928fc6
Does this test file barf for you too? (download (right click, save as) and rename to a .php file, obviously...)
http://www.creapsoft.co.uk/download?id=44928fc6
- chrisjlocke
- Top Contributor
- Posts: 995
- Joined: Mon Aug 01, 2005 4:12 pm
- Location: Essex, UK
- Contact:
I was going to suggest moving this thread to support, thanks.
This is an example code fragment that gives errors, I've replaced the PHP start & end with a comment block so it's displayed OK on here:
Ignore the functionality of the code, I've stripped many lines.
That reports Four long line errors then Syntax OK on my setup...
This is an example code fragment that gives errors, I've replaced the PHP start & end with a comment block so it's displayed OK on here:
Code: Select all
/*
function get_data_list($dv_list,$mode) {
if ($result && ($res_rows=db_numrows($result)) > 0) {
add_data_list(&$dv_list,&$result);
}
}
*/
That reports Four long line errors then Syntax OK on my setup...
Robert Jenkins
Preview is working fine now, but as mentioned the results change with different PHP versions. Two of the three versions I've tried simply report 'OK' or 'NG' rather than reporting error details.
On a version that gives details of the errors, the number of 'long Line' errors matches the number of ultra-long warning lines PHP produces.
There seems to be a buffer problem somewhere between php.exe & rapid PHP when an output line is above a certain length.
This should be absolutely reproducable simply by adding an old style call by reference with the '&' in a function call (rather than the function definition).
The result is a 450+ character warning/explanation line from php.exe on each instance of a call by reference & a long line error displayed in Rapid PHP.
On a version that gives details of the errors, the number of 'long Line' errors matches the number of ultra-long warning lines PHP produces.
There seems to be a buffer problem somewhere between php.exe & rapid PHP when an output line is above a certain length.
This should be absolutely reproducable simply by adding an old style call by reference with the '&' in a function call (rather than the function definition).
The result is a 450+ character warning/explanation line from php.exe on each instance of a call by reference & a long line error displayed in Rapid PHP.
Robert Jenkins
In connection with syntax checking again, a low-priority feature request:
PHP5 has been out for a while and is starting to appear on web servers.
(There appear to some problems in the 64 bit builds prior to V5.something).
How about a dual setup in the Syntax check config so you can have two PHP installs (e.g. in \php4 & \php5 ) and select within the project settings which version you want to use for that project?
PHP5 has been out for a while and is starting to appear on web servers.
(There appear to some problems in the 64 bit builds prior to V5.something).
How about a dual setup in the Syntax check config so you can have two PHP installs (e.g. in \php4 & \php5 ) and select within the project settings which version you want to use for that project?
Robert Jenkins