Click to See Complete Forum and Search --> : [RESOLVED] __autoload fails in Zend encoded files


Ipsens
January 6th, 2008, 09:24 PM
function __autoload($class_name)
{
require_once($_SERVER['DOCUMENT_ROOT'] . '/path/' . $class_name . '.php');
}

Doesn't work when I obfuscate php files with Zend encoder, because it obfuscate class_name.

How do I make it work instead.
Right now I forced to write long require() list.
Duh!

Please post full solution in ... example

Thanks in advance!
;)

PeejAvery
January 7th, 2008, 08:17 AM
Unless other people have admin access to your web server, you don't need Zend Encoder. What is your main purpose in using it?

Have you thought about writing an array and looping through that for the includes (required) files?

Ipsens
January 8th, 2008, 09:28 AM
Well, code is unique so I wana to protect it...

Anyway, there is no easy solution for this so I've created complex function to solve it, especially if we take into consideration that __autoload doesn't work in CLI mode too.

So that function will always load all depnadant classes no matter what env is.

PS: Yes I did thought about looping array long ago and it is a part of above function. :D