PEAK XOOPS - Safe method to check for loaded classes in englishin japanese

Safe method to check for loaded classes

List posts in the topic

report Safe method to check for loaded classes

msg# 1
depth:
0
Previous post - Next post | Parent - No child | Posted on 2010/12/31 8:40
skenow  二等兵 From: Minnesota  Posts: 9
Hi, GiJoe - In trust_path/modules/protector/include/precheck.inc.php, you are testing to see if the Database class exists before including postcheck.inc.php. This is OK - if the cms is not using a true autoload system (spl_autoload_register()), as is being done in ImpressCMS 1.3.

When class_exists() checks for a class and the spl_autoload_register has already triggered, the class is loaded, if it isn't already. This causes Protector to get caught in a loop, constantly loading precheck and postcheck until PHP runs out of memory. Here is a safer way to perform the check,

if (in_array('Database', get_declared_classes())) {

Many thanks for your work!
Votes:3 Average:3.33

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!