set_error_handler函数未调用自动加载 [英] set_error_handler function not calling autoload

查看:70
本文介绍了set_error_handler函数未调用自动加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将set_error_handler()函数设置为在发生错误时调用函数.

I have the set_error_handler() function set to call a function when there is an error.

在该函数中,我有自己的异常类实现:

In that function I have my own implementation of the exception class:

function acs_error_handler($errno, $errstr, $errfile, $errline) {    
    throw new acs_exception($errstr, $errno);     
}

这给了我以下错误:

致命错误:找不到类"acs_exception"

Fatal error: Class 'acs_exception' not found

由于某些原因,此函数不会调用我使用以下方法设置的自动加载函数:

For some reason, this function does not call my autoload function which I have set up using:

spl_autoload_register('__autoload');

如果我添加以下行:

__autoload('acs_exception');

在错误函数中调用类之前,所有方法都可以正常工作.

before calling the class in the error function it all works.

我的问题是:当我在错误触发函数中调用acs_exception类时,__autoload()函数是否应该触发?

My question is: Shouldn't the __autoload() function fire when I call the acs_exception class in the error trigger function??

推荐答案

这是一个相关的PHP错误报告.

您的错误在以下位置触发 编译时,禁用自动加载 (和spl_autoload同时).

Your error is triggered at compile-time, which disables autoload (and spl_autoload at the same time).

可能不会为PHP5.3修复 导致很多其他问题.

Won't be fixed for PHP5.3 as it may cause lots of other problems.

这篇关于set_error_handler函数未调用自动加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆