Re: [PHP] Cannot redeclare function

2004-08-10 Thread Jason Wong
On Wednesday 11 August 2004 05:18, Alex Hogan wrote:

> Apparently I must've been calling it from someplace else that I can't
> find, and changing to include_once() fixed the problem.  I just don't
> understand why it worked for as long as it did before now.

Once upon a time PHP allowed a function to be declared multiple times.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
When I met th'POPE back in '58, I scrubbed him with a MILD SOAP or
DETERGENT for 15 minutes.  He seemed to enjoy it ...
*/

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



RE: [PHP] Cannot redeclare function

2004-08-10 Thread Alex Hogan
[snip]
> Well, it's very likely that that file was being included 
> twice. You just can't do an include() on the same file twice 
> if it defines functions or classes. Look through your code 
> and see all of the places where the include was happening. 
> Perhaps the file that includes that file is being included twice.
[/snip]

I checked that.  I have all the includes at the top of the page only
being brought in from a config file.
I checked the config file for that directory and it only calls the files
once.  No duplication.
I even checked the classes to insure that there wasn't any duplicate
functionality or duplicate calls.

Apparently I must've been calling it from someplace else that I can't
find, and changing to include_once() fixed the problem.  I just don't
understand why it worked for as long as it did before now.


alex hogan
*
The contents of this e-mail and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom it is addressed. The 
views stated herein do not necessarily represent the view of the company. If you are 
not the intended recipient of this e-mail you may not copy, forward, disclose, or 
otherwise use it or any part of it in any form whatsoever. If you have received this 
e-mail in error please e-mail the sender. 
*

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



Re: [PHP] Cannot redeclare function

2004-08-10 Thread Justin Patrin
On Tue, 10 Aug 2004 14:07:09 -0500, Alex Hogan
<[EMAIL PROTECTED]> wrote:
> > Did your error_reporting level change with the upgrade? This
> > was more than likely silently ignored with PHP4 and now
> > showing as a warning/error in PHP5 or just dependent upon
> > your error_reporting level.
> 
> No..,
> 
> I was careful to set 5 up with as many of the same settings as the
> previous version.  I only had half a day to change the production
> environment so I wanted to make sure there was no lag.  Unless there was
> something that I missed.
> 
> At first I thought that I had either duplicated the function someplace
> else, but that wasn't the case.
> 

Well, it's very likely that that file was being included twice. You
just can't do an include() on the same file twice if it defines
functions or classes. Look through your code and see all of the places
where the include was happening. Perhaps the file that includes that
file is being included twice.

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

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



RE: [PHP] Cannot redeclare function

2004-08-10 Thread Alex Hogan
> Did your error_reporting level change with the upgrade? This 
> was more than likely silently ignored with PHP4 and now 
> showing as a warning/error in PHP5 or just dependent upon 
> your error_reporting level.

No..,

I was careful to set 5 up with as many of the same settings as the
previous version.  I only had half a day to change the production
environment so I wanted to make sure there was no lag.  Unless there was
something that I missed.

At first I thought that I had either duplicated the function someplace
else, but that wasn't the case.


alex hogan
*
The contents of this e-mail and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom it is addressed. The 
views stated herein do not necessarily represent the view of the company. If you are 
not the intended recipient of this e-mail you may not copy, forward, disclose, or 
otherwise use it or any part of it in any form whatsoever. If you have received this 
e-mail in error please e-mail the sender. 
*

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



RE: [PHP] Cannot redeclare function

2004-08-10 Thread Ed Lazor
It's probably not PHP 5 and more likely that someone changed the php.ini
error reporting settings in the process of upgrading (or maybe PHP 5 has a
different set of default settings?).

You should probably trace through your application and note what files are
being loaded, in what order, etc.. so thath you can identify why the error
occurred.  Using include_once fixes the problem but may not address bigger
issues.

-Ed


> -Original Message-
> Hi All,
> 
> 
> I have a registration page that hasn't changed in several weeks.  Today
> it decided to freak-out by throwing an error;
> 'Cannot redeclare myfunctionname() on line 10 of myfunctions.inc'
> 
> Nothing has changed in either the calling page, or the function.  The
> only thing that has changed since these files were put into production
> is the upgrade on php to 5.
> 
> I've looked through the release notes and found nothing.  I looked
> through the manual and found nothing that I can really put my finger on.
> I was able to correct the problem with changing the 'include()' to
> 'include_once()', but I really want to know why this happened and why it
> didn't throw that error until now.
> 
> 
> alex hogan

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



Re: [PHP] Cannot redeclare function

2004-08-10 Thread John W. Holmes
From: "Alex Hogan" <[EMAIL PROTECTED]>
> I have a registration page that hasn't changed in several weeks.  Today
> it decided to freak-out by throwing an error;
> 'Cannot redeclare myfunctionname() on line 10 of myfunctions.inc'
>
> Nothing has changed in either the calling page, or the function.  The
> only thing that has changed since these files were put into production
> is the upgrade on php to 5.

Did your error_reporting level change with the upgrade? This was more than
likely silently ignored with PHP4 and now showing as a warning/error in PHP5
or just dependent upon your error_reporting level.

---John Holmes...

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



[PHP] Cannot redeclare function

2004-08-10 Thread Alex Hogan
Hi All,


I have a registration page that hasn't changed in several weeks.  Today
it decided to freak-out by throwing an error;
'Cannot redeclare myfunctionname() on line 10 of myfunctions.inc'

Nothing has changed in either the calling page, or the function.  The
only thing that has changed since these files were put into production
is the upgrade on php to 5.

I've looked through the release notes and found nothing.  I looked
through the manual and found nothing that I can really put my finger on.
I was able to correct the problem with changing the 'include()' to
'include_once()', but I really want to know why this happened and why it
didn't throw that error until now.


alex hogan

 

*
The contents of this e-mail and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom it is addressed. The 
views stated herein do not necessarily represent the view of the company. If you are 
not the intended recipient of this e-mail you may not copy, forward, disclose, or 
otherwise use it or any part of it in any form whatsoever. If you have received this 
e-mail in error please e-mail the sender. 
*

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



[PHP] Cannot Redeclare?

2002-09-22 Thread Stephen Craton

Hello,

I was just wondering...again...why the heck I keep getting this error.
I'm trying to make a function called login() and sometimes it works,
other times it hates me and gives me this error:

Fatal error: Cannot redeclare login() in
c:\apache\htdocs\wiredphp\member\funcs.php on line 5

Here's the contents of the function login():

function login($username, $password)
{
  $sql = "select * from members where username='$username' and passwd =
password('$password')";
  $result = mysql_query($sql, $wired);
  if (!$result)
 return 0;
  
  if (mysql_num_rows($result)>0)
 return 1;
  else 
 return 0;
}

Please help. I don't see why this keeps happening...

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us



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




RE: [PHP] PHP "Cannot redeclare class" problem

2002-09-21 Thread Paul Maine

I was able to solve the problem by using the "require_once " statement.

Thank You

-Original Message-
From: Paul Maine [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 10:23 AM
To: PHP PHP
Subject: [PHP] PHP "Cannot redeclare class" problem


When I call the function batch_delayed_capture(see below), I issue the
"$this->delayed_capture($d);" statement. Both batch_delayed_capture and
delayed_capture are in the same include file. The statement works fine the
first time through the loop but gives the following error "Cannot redeclare
class pfp_class"(see below). I added some echo statements to help identify
where the problem was occuring.

Your assistance is greatly appreciated.

Paul
PHP,MySQL

*
Array element 0= 21203749pnref=  Made it to delayed capture Just after
delayed capyure Array element 1= 21203748pnref= 1
Fatal error: Cannot redeclare class pfp_class in
/var/www/html/shop/modules/checkout/lib/_class.pfp.php on line 76

*
function batch_delayed_capture(&$d) {

   global $auth,
   $ps_vendor_id;

   if ($d) {
 //echo "Inside POST\n";
 while (list($lvar, $lvalue) = each($d)) {
   if (ereg ("^d_c_arr", $lvar, $throwaway)) {
   $batch_d_c[]=$d["$lvar"];
   }
 }
   }

   $dbresponse = new ps_DB;


for($i = 0; $i < sizeof($batch_d_c); $i++){

  echo " Array element $i= " . $batch_d_c[$i];

  $qr = "SELECT pnref from transaction_response WHERE result='0' ";
  $qr .= "AND order_id=$batch_d_c[$i] AND delay_capture IS NULL";
  $dbresponse->query($qr);
  $dbresponse->next_record();
  $d["pnref"]=$dbresponse->f("pnref");
  echo "pnref= " . $d["pnref"];

  $this->delayed_capture($d);
  echo "Just after delayed capyure";
}


return True;

 }

**


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


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




[PHP] PHP "Cannot redeclare class" problem

2002-09-21 Thread Paul Maine

When I call the function batch_delayed_capture(see below), I issue the
"$this->delayed_capture($d);" statement. Both batch_delayed_capture and
delayed_capture are in the same include file. The statement works fine the
first time through the loop but gives the following error "Cannot redeclare
class pfp_class"(see below). I added some echo statements to help identify
where the problem was occuring.

Your assistance is greatly appreciated.

Paul
PHP,MySQL

*
Array element 0= 21203749pnref=  Made it to delayed capture Just after
delayed capyure Array element 1= 21203748pnref= 1
Fatal error: Cannot redeclare class pfp_class in
/var/www/html/shop/modules/checkout/lib/_class.pfp.php on line 76

*
function batch_delayed_capture(&$d) {

   global $auth,
   $ps_vendor_id;

   if ($d) {
 //echo "Inside POST\n";
 while (list($lvar, $lvalue) = each($d)) {
   if (ereg ("^d_c_arr", $lvar, $throwaway)) {
   $batch_d_c[]=$d["$lvar"];
   }
 }
   }

   $dbresponse = new ps_DB;


for($i = 0; $i < sizeof($batch_d_c); $i++){

  echo " Array element $i= " . $batch_d_c[$i];

  $qr = "SELECT pnref from transaction_response WHERE result='0' ";
  $qr .= "AND order_id=$batch_d_c[$i] AND delay_capture IS NULL";
  $dbresponse->query($qr);
  $dbresponse->next_record();
  $d["pnref"]=$dbresponse->f("pnref");
  echo "pnref= " . $d["pnref"];

  $this->delayed_capture($d);
  echo "Just after delayed capyure";
}


return True;

 }

**


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




[PHP] Cannot Redeclare Function

2002-09-19 Thread Robert Miller

Hello,

My function to read a comma separated text file and return a sorted multi-dimensional 
array will not work if used more than once per page.

I know why I'm having this problem. But, I don't know how to solve it. :-(





Calling it Twice:
$services = tbl2array ("../locations/service.txt", "default", $divdetail['id'], "0");
$collections = tbl2array ("../download/collection.txt", "name", $divdetail['id'], "4");


The Error:
Fatal error: Cannot redeclare compname() in ../tbl2array.inc on line 35


Function Table 2 Array:




--
Robert J. Miller
Internet Support Specialist
Department of Government Services and Lands
P.O. Box 8700, St. John's, NF., A1B-4J6
(709) 729-4520 (phone)
(709) 729-4151 (facsimile)
(709) 778-8746 (pager)

http://www.gov.nf.ca/gsl/
mailto:[EMAIL PROTECTED]
--
Simple things should be simple and hard things
should be possible.
--


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