|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2008-04-04 10:16 UTC] felipe@php.net
  [2008-04-12 01:00 UTC] php-bugs at lists dot php dot net
  [2008-04-15 07:09 UTC] bigtree at 29a dot nl
  [2008-04-15 07:27 UTC] bigtree at 29a dot nl
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 18:00:01 2025 UTC | 
Description: ------------ When implicitely casting class_exists() to a boolean, a memory leak occurs. It does not matter if the given class exists or not. Reproduce code: --------------- for ($i = 1; $i < 100; $i++) { if (class_exists('foo')) { } echo memory_get_usage() . "\n"; } Expected result: ---------------- A constant amount of memory (at least after the first iteratation) Actual result: -------------- A growing amount of used memory. A workaround can be: if ((boolean)class_exists('foo')) { } or $foo = class_exists('foo'); if ($foo) {} in these cases the memory leak does not occur