php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20473 Cannot redeclare gc()
Submitted: 2002-11-18 01:30 UTC Modified: 2002-11-18 01:56 UTC
From: hofmann at isl dot org Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.3.0RC1 OS: Linux
Private report: No CVE-ID: None
 [2002-11-18 01:30 UTC] hofmann at isl dot org
Our webserver scripts make heavy use of the phplib.
with php4.3.0rc1 I will get the error

Fatal error: Cannot redeclare gc() in /usr/lib/php/phplib/session.inc on line 461

thats because phplib defines a function named gc().

with the php4.3.pre1 and earlier versions this problem has not been apeared - last but not least with the documentation I have not found a hint about a gc() function within php itself.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-18 01:56 UTC] hofmann at isl dot org
seems that this is an enhancement of php - because the bug is really in phplib. sorry.
 [2002-12-06 21:56 UTC] craigm at ace dot com dot au
Has anybody got a solution for this problem. The same thing is happening to some of our websites. Is there some setting in php.ini file that can be set to get around this problem.

Thanks,

Craig Marchant
 [2003-01-02 07:42 UTC] phpbugs at dewet dot org
This one also just hit me upgrading from 4.2.3 to 4.3.0 on 
Gentoo Linux.  Since I cannot seem to find a solution 
online, I will try and rename the PHPLIB functions.
 [2003-02-04 15:30 UTC] skerdog at hotmail dot com
SURELY someone knows how to fix this annoying error?  It was first reported over 2 months ago and there are no postings on this problem report showing a resolution.  Well?
 [2003-02-10 16:29 UTC] edwin-php dot net at mavetju dot org
I found it to be an old line in my php.ini:

auto_prepend = /usr/local/apache/php/prepend.php3

Update your php.ini and you'll see it goes away again.

Edwin, bitten by this problem too :-)
 [2003-04-08 20:31 UTC] dave at toad dot net
The problem does not appear to be that php defines a gc() function that phplib is clobbering, but that phplib's session.inc file actually tries to define gc() twice.

I was able to eliminate the error message and problems by commenting out the first gc() declaration in session.inc, as follows:

        // Garbage collection
        //
        // Destroy all session data older than this
        // COMMENTED THIS FUNCTION OUT DCT 4/8/03
        /* function gc() {
                $this->that->ac_gc($this->gc_time, $this->name);
        } */

Would be interested in anyone's opinion as to whether this was terribly foolish, or an accurate fix to the problem.
 [2003-11-18 05:00 UTC] frodelan at netcom dot no
I have the same problem still, because of this I have to run php 4.2.2 and this made me sad! I've tried to run php 4.3.4 and I get the "Cannot redeclare gc() in session.inc"-problem.
Is there anyone that will fix this problem?
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu May 19 06:05:44 2022 UTC