|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 03:00:01 2025 UTC | 
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.