Tag: 致命错误

我怎样才能捕捉到PHPtypes提示“可捕捉的致命错误”?

我试图在我的一个类中实现PHP5的Type Hinting, class ClassA { public function method_a (ClassB $b) {} } class ClassB {} class ClassWrong{} 正确的用法: $a = new ClassA; $a->method_a(new ClassB); 产生错误: $a = new ClassA; $a->method_a(new ClassWrong); 可捕获的致命错误:传递给ClassA :: method_a()的参数1必须是ClassB的实例,ClassWrong的实例被赋予… 我可以知道是否有可能发现这个错误(因为它说“可捕捉”)? 如果是的话,怎么样? 谢谢。

致命错误:当不在对象上下文中时使用$ this

这里是错误的部分。 致命错误:在不在第6行的/pb_events.php中的对象上下文中时使用$ this 第6行是: $jpp = $this->vars->data["jpp"]; function DoEvents($this) { global $_CONF, $_PAGE, $_TSM , $base; $jpp = $this->vars->data["jpp"]; $cache["departments"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_departments]}"); $cache["locations"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_location]}"); $cache["names"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_names]}"); $cache["categories"] = $this->db->QFetchRowArray("SELECT * FROM {$this->tables[job_categories]}"); 非常感谢! 欣赏!

如何捕捉致命错误:PHP中超过30秒的最大执行时间

我一直在玩一个我正在开发的系统,并设法让它导致: 致命错误:超过30秒的最大执行时间 这发生在我做一些不切实际的事情时,但却可能发生在用户身上。 有谁知道是否有办法赶上这个例外? 我已经阅读,但似乎每个人都build议提高时间。

PHP:自定义error handling程序 – 处理分析和致命错误

我怎样才能处理parsing和致命错误使用自定义error handling程序?

奇怪的PHP错误:'不能在写入上下文中使用函数返回值'

我得到这个错误,我不能做它的头或尾巴。 确切的错误信息是: 致命错误:无法在第48行的/home/curricle/public_html/descarga/index.php中的写入上下文中使用函数返回值 48行是: if (isset($_POST('sms_code') == TRUE ) { 任何人都知道发生了什么? PS这是完整的function,以防万一: function validate_sms_code() { $state = NOTHING_SUBMITED; if (isset($_POST('sms_code') == TRUE ) { $sms_code = clean_up($_POST('sms_code')); $return_code = get_sepomo_code($sms_code); switch($return_code) { case 1: //no error $state = CORRECT_CODE; break; case 2: // code already used $state = CODE_ALREADY_USED; break; case 3: // wrong code […]

PHP致命错误:当不在对象上下文中时使用$ this

我有一个问题: 我正在编写一个没有框架的新WebApp。 在我的index.php我使用: require_once('load.php'); 在load.php我使用require_once('class.php'); 加载我的class.php 。 在我的class.php我有这个错误: 致命错误:当不在class.php的对象上下文中使用$ this时…(在这个例子中是11) 一个例子是如何写我的class.php : class foobar { public $foo; public function __construct() { global $foo; $this->foo = $foo; } public function foobarfunc() { return $this->foo(); } public function foo() { return $this->foo; } } 在我的index.php我加载也许foobarfunc()像这样: foobar::foobarfunc(); 但也可以 $foobar = new foobar; $foobar->foobarfunc(); 为什么会出现错误?

如何捕获PHP致命错误

我可以使用set_error_handler()来捕获大多数PHP错误,但是它不适用于致命( E_ERROR )错误,例如调用一个不存在的函数。 是否有另一种方法来捕捉这些错误? 我想调用mail()的所有错误,并运行PHP 5.2.3。