On 8 September 2011 21:31, Michael Sole <ms...@gold-mobile.com> wrote:
> We had previously used autoload but removed it and we are now using
> spl_autoload. In development it works fine but in QA it throws this error. I
> grepped for autoload but could not find any instance in any file. Is there
> anyway to determine what is cause log4php to throw this error?
>
> I know this is an abstract question but I am a bit stumped.

Hi Mike,

That is a strange problem.

This check was a request from one of our users [1]. It should not
trigger the warning if you use spl_autoload.

The check works like this (at Logger.php:21):
if (function_exists('__autoload')) {
    trigger_error("log4php: It looks like your code is using an
__autoload() function. log4php uses spl_autoload_register() which will
bypass your __autoload() function and may break autoloading.",
E_USER_WARNING);
}

Basically, if there is an __autoload method defined at the moment you
include log4php you should get this warning.

Is it possible that some extra code is loaded on your QA environment
which is not in dev?

You can try running something like:
<?php
var_dump(function_exists('__autoload'));
include 'my/code.php';
var_dump(function_exists('__autoload'));
?>

If __autoload defined within your code, the first var_dump will return
flase, and the second will return true.

Alternatively, put some var_dumps at critical locations within your
code (before and after includes).

I'm not sure what else to suggest at this point...

Regards,
--
Ivan

[1] https://issues.apache.org/jira/browse/LOG4PHP-129

Reply via email to