php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30075 Cannot redeclare function/class
Submitted: 2004-09-13 16:29 UTC Modified: 2004-12-06 01:00 UTC
Votes:30
Avg. Score:4.6 ± 0.7
Reproduced:25 of 26 (96.2%)
Same Version:9 (36.0%)
Same OS:10 (40.0%)
From: kj at legalizer dot dk Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5CVS-2004-09-13 (dev) OS: WinXP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kj at legalizer dot dk
New email:
PHP Version: OS:

 

 [2004-09-13 16:29 UTC] kj at legalizer dot dk
Description:
------------
After installing PHP 5.0.1 (and latest CVS) I get "Cannot redeclare <functionname/classname> (previously declared in <filename>)" errors at random.

Then after a few seconds a window pops up with a dllhost.exe error. Saying somthing like "Memory could not be read". And my IIS chrashes.

All this do not happen every time i load the page only sometimes.

This did not happen in PHP 5.0.0.

Im running PHP as ISAPI. 

Actual result:
--------------
Fatal error: Cannot redeclare db_connect() (previously declared in D:\HTDocs\BEC\includes\database.inc.php:8) in D:\HTDocs\BEC\includes\database.inc.php on line 10

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-13 16:38 UTC] kj at legalizer dot dk
It looks like I dont get the error if I turn off ISAPI caching.
 [2004-09-27 09:34 UTC] kj at legalizer dot dk
With PHP 5.0.2 and IIS 6.0 I get the same error (without the crash) even if I turn off ISAPI caching.
 [2004-09-27 09:37 UTC] kj at legalizer dot dk
The IIS 6.0 problem is on a Windows 2003 server.
 [2004-11-28 15:44 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Please supply short but usable reproduce script if you still expirience this problem even with latest CVS snapshot.
 [2004-12-06 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-05-24 12:47 UTC] andized at gmx dot net
i got the same problem with php 5.1.2 on MS IIS 6.0 on a windows 2003 Server.
"Cannot redeclare ..." appears at random, but the file is only included once.
 [2007-11-27 18:34 UTC] brianleeholub at yahoo dot com
This is happening in 5.2.5 (also win2k3-sp2, iis6, isapi). Since most of the pages in the application I'm testing are fairly complex, I created a test script with a single function to do some basic math. After browsing around a bit in the main application (and seeing the "redeclare" bug, probably 15% of the page loads, with random functions being the culprit even when reloading the same page), I pointed at my test script and refreshed once or twice and got: PHP has encountered an Access Violation at 01B09F7E

The main application is heavy in SOAP.
 [2007-11-27 18:53 UTC] brianleeholub at yahoo dot com
After trying apache 2.2.4 on the same machine/same php the content flashes up and then firefox goes to an error page. In the event log I get this:

Event Type:	Error
Event Source:	Application Error
Event Category:	(100)
Event ID:	1000
Date:		11/27/2007
Time:		10:47:14 AM
User:		N/A
Computer:	BH-DEV4
Description:
Faulting application httpd.exe, version 2.2.4.0, faulting module php5ts.dll, version 5.2.5.5, fault address 0x000ce75a.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 41 70 70 6c 69 63 61 74   Applicat
0008: 69 6f 6e 20 46 61 69 6c   ion Fail
0010: 75 72 65 20 20 68 74 74   ure  htt
0018: 70 64 2e 65 78 65 20 32   pd.exe 2
0020: 2e 32 2e 34 2e 30 20 69   .2.4.0 i
0028: 6e 20 70 68 70 35 74 73   n php5ts
0030: 2e 64 6c 6c 20 35 2e 32   .dll 5.2
0038: 2e 35 2e 35 20 61 74 20   .5.5 at 
0040: 6f 66 66 73 65 74 20 30   offset 0
0048: 30 30 63 65 37 35 61      00ce75a
 [2008-02-11 01:55 UTC] wes at clevemail dot net
I am brand new to PHP. Here are my particulars with this problem. I am running:

Windows XP 5.1.2600 Service Pack 2 Build 2600
IIS 5.1
PHP 5.2.5 installed from php-5.2.5-Win32.zip
  defined to IIS using php5isapi.dll
MySQL 5.0.51a Win32
phpMyAdmin 2.1.4

I built a test page that only contains phpinfo(). It loads fine.

When I load phpMyAdmin, I get the login page. After supplying my user name and password, I get:

Fatal error: Cannot redeclare pma_ifsetor() (previously declared in D:\My Web Sites\phpMyAdmin\libraries\core.lib.php:38) in D:\My Web Sites\phpMyAdmin\libraries\core.lib.php on line 45

Notice that the previous declaration and the current declaration are in the same file (including the same path) at different line numbers. The fact is that in this file, line 38 is the PMA_ifSetOr() function declaration, while line 45 is then end of the fPMA_ifSetOr function (i.e. the ending "}"):

38 function PMA_ifSetOr(&$var, $default = null, $type = 'similar')
39 {
40     if (! PMA_isValid($var, $type, $default)) {
41         return $default;
42     }
43 
44     return $var;
45 }


One other interesting observation: If I restart IIS and then press F5, the page then loads successfully. Once I get this error, pressing F5 returns the same error until I restart IIS. Then (at least every time so far), the page loads fine.
 [2008-09-29 21:23 UTC] jherer at gmail dot com
Having the same problem with 5.1.0 on windows 2003. Is there a solution 
for this problem?
 [2010-03-10 09:38 UTC] eugenio at blux dot org
Same problem (Cannot redeclare functions...) with php 5.2.3 and IIS 6 on windows 2003 Small Business Server. Php in ISAPI.
 [2010-05-08 17:39 UTC] rmac at iki dot fi
I found out one way how this error message can happen: it happens if you declare a 
function with a reserved name. So try changing the name of function to something 
else.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC