StackOverflowers同学!
我有个奇怪的问题。让我写一个简短的描述:
这是我的文件夹层次
- ''sys''core''core.php,具有声明的命名空间sys''core和类名core
- ''sys''ttracts''singleton.php,具有声明的命名空间sys''ttraits和trait名称singleton
- ''pub''index.php(没有声明的命名空间,包括自动加载函数,该函数负责基于命名空间声明的其余加载文件)
''sys''ttracts''singleton.php
trait singleton {
private static $_instance = false;
public static function get_instance() {
if( self::$_instance == false ) {
self::$_instance = new self();
}
return self::$_instance;
}
}
''sys''core''core.php
namespace sys'core;
class core {
use 'sys'traits'singleton;
public function __construct() {
$ =; // just an example, it shall produce a nice parse error but it wont :(
}
}
在''pub''index.php中,我有
error_reporting(E_ALL);
// some constants defined
require('path/to/my/autoload/which/works/correctly.php');
use sys'core'core as core;
$core = core::get_instance();
$core->load_controller();
基本上,任何类型的错误(parse error / warning etc
)都会显示出来,除非是在名称空间内引起的。因此,'pub'index.php
中的任何错误都会得到正确的报告(根据需要),但在具有声明名称空间的文件中发生的每个错误都会导致白色页面,没有显示任何错误(尽管error_reporting在任何可能的地方都设置为E_ALL
,甚至在php.ini中)
我的配置信息:
PHP 5.5.0(来自dotdeb.org的包)通过PHP-FPM运行nginx 1.4.1(来自dotdeb.org的包,nginx的error.log也是空的,即使它正常保存任何类型的PHP错误)在Debian(Testing/Sid)上运行
有什么提示吗?我会感谢任何信息!提前感谢!
问题已解决(尽管它无论如何都没有连接到命名空间)
@在include()不是从include中静音错误之前,它会静音包含文件中抛出的所有错误(我想知道它以前是这样的…)
无论如何,这个问题是可以封闭的,可以利用的&遗忘