473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Script error message is referencing wrong line of code

Im developing php pages under apache and Mac OS X. When I have a
scripting error, the error page says...

....error occurred at line 139

Problem is that line 139 is blank and the bad code is really on line
142. Its usaully off by random numbers so I cant just add/subtract a
couple of numbers to guess the real line of problem code. This is a
pain and is slowing me up for trouble-shooting scripts. Any
suggestions? Is this a php.ini setting? -Nick
Jul 17 '05 #1
4 2720
I noticed that Message-ID:
<ce**************************@posting.google.com > from Nick contained
the following:
...error occurred at line 139

Problem is that line 139 is blank and the bad code is really on line
142. Its usaully off by random numbers so I cant just add/subtract a
couple of numbers to guess the real line of problem code.


That happens a lot. The error will not show until the script gets to a
point where the lack of something makes a difference. This could be
many lines away from the point where the error was made.

All part of the joys of debugging...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Nick wrote:
Im developing php pages under apache and Mac OS X. When I have a
scripting error, the error page says...

...error occurred at line 139

Problem is that line 139 is blank and the bad code is really on line
142. Its usaully off by random numbers so I cant just add/subtract a
couple of numbers to guess the real line of problem code. This is a
pain and is slowing me up for trouble-shooting scripts. Any
suggestions? Is this a php.ini setting? -Nick


Imagine the following (bad) function that takes an integer and returns
the sum of all integer from 1 to the one specified:
1 <?php
2 function sum_integer($n) {
3 $total = 0;
4
5 if ($n > 0) {
6 while ($n) {
7 $total += $n;
8 $n -= 1;
9 # } // error here
10 return $total;
11 }
12 return 0;
13 }
14
15 ?>
16

PHP will report the error at line 17! line 17 is not even part of the
file!!
Debugging is a very interesting activity :-)

/me loves debugging
/me loves programs/scripts that do not work :-)))
[disclaimer: mostly when those program/scripts are my own]

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #3
"Nick" <nb********@hotmail.com> wrote in message
news:ce**************************@posting.google.c om...
Im developing php pages under apache and Mac OS X. When I have a
scripting error, the error page says...

...error occurred at line 139

Problem is that line 139 is blank and the bad code is really on line
142. Its usaully off by random numbers so I cant just add/subtract a
couple of numbers to guess the real line of problem code. This is a
pain and is slowing me up for trouble-shooting scripts. Any
suggestions? Is this a php.ini setting? -Nick


Line wrapping, perhaps?
Jul 17 '05 #4
Hey guys, thanks for responding. I finally found out the answer. My
editor (Dreamweaver) had line breaks set for Mac OS. Changing line
breaks to Unix or Windows fixed the problem. Relief! -Nick
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: bojanraic | last post by:
Hi! I recently started playing with Python CGI, and I was happy that my basic input-name--print-hello-name CGI form example worked, so I thought I should advance to somew\hat more complicated...
12
by: Bob Stearns | last post by:
I am trying to create a duplicate prevention trigger: CREATE TRIGGER is3.ard_u_unique BEFORE UPDATE OF act_recov_date ON is3.flushes REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL WHEN...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
13
by: Max | last post by:
Hi There! I'm having a mysterious error right after I login using Forms Authentication in my ASP.NET app. Below is the error... Exception Details: System.NullReferenceException: Object...
16
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
7
by: Brett | last post by:
I'm not sure why I keep getting this error, "Object reference not set to an instance of an object". Private Function somefunction() as string Dim MyCurrentClass As New Class1 Try For i As...
2
by: BookerW | last post by:
Ok, here is the situation. I have some vb code that was upgraded to the earliest asp, I believe. When i run this snippet of code below on my local xp box with iis and visual studio 2003...
20
by: Pete Marsh | last post by:
Wondering if anyone can see an error with this script. I get a server configuration error. THat could mean a module is not being loaded, but maybe there's a syntax error here, can anyone spot it?...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.