Re: [PHP] Gawd I hate those useless error messages...

2004-10-30 Thread -{ Rene Brehmer }-
At 15:56 29-10-2004, Richard Davey wrote:
Hello -{,
Friday, October 29, 2004, 3:28:39 PM, you wrote:
RB> since this is the test-server, I run with all errors, alerts, and messages
RB> on, but isn't there someway to make PHP just a little more helpful when
RB> this happens ???
Use an IDE that high-lights typos like this for you? Before it even
gets are far as PHP debugging it? Zend Studio for example would do
this (it did it to me several times this morning!)
Thanks ... will look into it :)
Rene
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Gawd I hate those useless error messages...

2004-10-29 Thread -{ Rene Brehmer }-
At 17:00 29-10-2004, Robby Russell wrote:
On Fri, 2004-10-29 at 16:28 +0200, -{ Rene Brehmer }- wrote:
> Hi gang
>
> I do realise that this error means I've forgotten a curly brace or
> semi-colon somewhere, but seriously ...
>
> Parse error: parse error, unexpected $end in 
E:\web\Metalbunny\addguest.php
> on line 274
>
> where line 274 would be the last line, obviously (since it's always the
> last line when it does this)...
[snip]
Yeah, don't make errors in your code. ;-)
Oh, that I do try ... perfectionist at heart :p

Also, try to seperate your html and php code as much as possible. Use a
template system of some form. (ie. smarty)
I am, trust me :) ... There are just some cases where it's not really 
practical to split the scripts anymore than I do. Like in this case where 
it's the submission form for the guestbook ... First I've got about 200 
lines of code (ok, 30 of them is an array with country names that I only 
use on this page and nowhere else) that handle the part of the form 
evaluation and SQL generation that is unique to this page, and outputting 
error and thank you notices as needed. Then there's the form itself with 
the embedded PHP code to refill the form in case of errors. It's the last 
part where I jump in and out of PHP, since it really IS the simplest way to 
get the PHP to put data into an otherwise static chunk of HTML.

I use my own made template system. It's made in a shell form, where the 
scripts simply put the top and the bottom in so the generated body goes in 
between. It's not the most elegant solution, but my latest revision is a 
bit more intelligent made so the templates keeps track of basically 
everything but the body generation. But it works fast, and speed is my main 
concern, since some of the pages can get a bit lengthy depending on 
queries. All longer text pieces are in seperate text/html-files and are 
simply included if/when needed.

I haven't really looked at special-made template systems because my own 
works well enough for my needs ... and as long as it can generate even the 
heaviest page in 10 secs I'm happy.

Use a PHP editor with syntax highlighting..click on one curly brace and
then find where the other highlighted brace is and make sure that it
where it should end.
Anyone you can recommend ? ... I've been using HomeSite for 6 years, and 
it's admittedly a little annoying when it comes to PHP, cuz although the 
colour-/bold-ing highlighting works for most commands, it's made to handle 
JavaScript, JSP, and ASP, so its understanding of PHP isn't the best.

Learn how to debug your code. See how far it's getting for each
thing..add test messages and die() in different scopes of code.
That I know ... but I've only been at PHP for 2 years, so still alot to 
learn ... but it's gotten better, and the errors are fewer. That said, the 
$end errors I run into nowadays are mostly caused when I rewrite my first 
scripts and delete large chunks of it that are no longer needed cuz I've 
got objects/functions that handle that now. Sometimes it's just the "ok, 
what does it look like now" approach that makes errors occur, when trying 
to run unfinished code.

Rene
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Gawd I hate those useless error messages...

2004-10-29 Thread Marek Kilimajer
-{ Rene Brehmer }- wrote:
Hi gang
I do realise that this error means I've forgotten a curly brace or 
semi-colon somewhere, but seriously ...

Parse error: parse error, unexpected $end in 
E:\web\Metalbunny\addguest.php on line 274

where line 274 would be the last line, obviously (since it's always the 
last line when it does this)...

now I'm lucky that this script in question has alot of HTML in it, so 
there's only about 180 lines of actual code, but is there really not 
something that can be done to PHP to make errors like these just a 
LITTLE easier to debug ???

It's not that bad in this particular case ... but when we have scripts 
of 500-800 lines code, or even more, it tends to be a rather not very 
helpful message... and it gets worse when you jump in and out of PHP ...

the '$end' and the '$' error are by far the most annoying errors, so 
hard to debug ... atleast with 'unexpected {' you have a slight chance 
as it limits the part you have to search through ...

since this is the test-server, I run with all errors, alerts, and 
messages on, but isn't there someway to make PHP just a little more 
helpful when this happens ???
Indent properly, use an editor that can find matching braces. PHP really 
can't give more meaningfull message, as it does not understand your code 
logic.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Gawd I hate those useless error messages...

2004-10-29 Thread Robby Russell
On Fri, 2004-10-29 at 16:28 +0200, -{ Rene Brehmer }- wrote:
> Hi gang
> 
> I do realise that this error means I've forgotten a curly brace or 
> semi-colon somewhere, but seriously ...
> 
> Parse error: parse error, unexpected $end in E:\web\Metalbunny\addguest.php 
> on line 274
> 
> where line 274 would be the last line, obviously (since it's always the 
> last line when it does this)...
> 
> now I'm lucky that this script in question has alot of HTML in it, so 
> there's only about 180 lines of actual code, but is there really not 
> something that can be done to PHP to make errors like these just a LITTLE 
> easier to debug ???
> 
> It's not that bad in this particular case ... but when we have scripts of 
> 500-800 lines code, or even more, it tends to be a rather not very helpful 
> message... and it gets worse when you jump in and out of PHP ...
> 
> the '$end' and the '$' error are by far the most annoying errors, so hard 
> to debug ... atleast with 'unexpected {' you have a slight chance as it 
> limits the part you have to search through ...
> 
> since this is the test-server, I run with all errors, alerts, and messages 
> on, but isn't there someway to make PHP just a little more helpful when 
> this happens ???
> 
> 

Yeah, don't make errors in your code. ;-)

Also, try to seperate your html and php code as much as possible. Use a
template system of some form. (ie. smarty)

Use a PHP editor with syntax highlighting..click on one curly brace and
then find where the other highlighted brace is and make sure that it
where it should end.

Learn how to debug your code. See how far it's getting for each
thing..add test messages and die() in different scopes of code.

Good luck,

Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Gawd I hate those useless error messages...

2004-10-29 Thread Greg Donald
On Fri, 29 Oct 2004 16:28:39 +0200, -{ Rene Brehmer }-
<[EMAIL PROTECTED]> wrote:
> I do realise that this error means I've forgotten a curly brace or
> semi-colon somewhere, but seriously ...

I use vim.  Shift-5 matches braces and parentheses easy enough.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Gawd I hate those useless error messages...

2004-10-29 Thread Richard Davey
Hello -{,

Friday, October 29, 2004, 3:28:39 PM, you wrote:

RB> since this is the test-server, I run with all errors, alerts, and messages
RB> on, but isn't there someway to make PHP just a little more helpful when
RB> this happens ???

Use an IDE that high-lights typos like this for you? Before it even
gets are far as PHP debugging it? Zend Studio for example would do
this (it did it to me several times this morning!)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Gawd I hate those useless error messages...

2004-10-29 Thread -{ Rene Brehmer }-
Hi gang
I do realise that this error means I've forgotten a curly brace or 
semi-colon somewhere, but seriously ...

Parse error: parse error, unexpected $end in E:\web\Metalbunny\addguest.php 
on line 274

where line 274 would be the last line, obviously (since it's always the 
last line when it does this)...

now I'm lucky that this script in question has alot of HTML in it, so 
there's only about 180 lines of actual code, but is there really not 
something that can be done to PHP to make errors like these just a LITTLE 
easier to debug ???

It's not that bad in this particular case ... but when we have scripts of 
500-800 lines code, or even more, it tends to be a rather not very helpful 
message... and it gets worse when you jump in and out of PHP ...

the '$end' and the '$' error are by far the most annoying errors, so hard 
to debug ... atleast with 'unexpected {' you have a slight chance as it 
limits the part you have to search through ...

since this is the test-server, I run with all errors, alerts, and messages 
on, but isn't there someway to make PHP just a little more helpful when 
this happens ???

Rene
--
Rene Brehmer
aka Metalbunny
If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php