我正在使用现有代码组合两个现有脚本来构建新的安全时间:
这两个脚本不能很好地发挥作用。我使用xdebug来发现主要问题是由php_simple_html_dom中的这段代码引起的:
if (($error=error_get_last())>null) {
$this->clear();
return false;
}
因为我使用的wordpress模板会触发一些E_NOTICE级错误,导致我的php_simple_html_dom被清除。
奇怪的是,我没有包含任何模板代码,因为我包括并自己实例化wp-db.php:
require_once('../wp-config.php');
require_once('../wp-includes/wp-db.php');
$wpdb = new wpdb(DB_USER,DB_PASSWORD,DB_NAME,DB_HOST);
即使我完全使用xdebug完成代码,它也永远不会从wordpress中击中其他任何东西,然后是wp-config.php或wp-db.php。
编辑:
如horatio所示,这实际上是从 在wp-config.php的末尾包含wp-settings.php。我现在 理解为什么我的调试器永远不会碰到它:netbeans没有成功 下载wp-settings.php,因此无法对其进行调试。
然而,这是error_get_last()
返回的错误:
Array
(
[type] => 8
[message] => Undefined index: id
[file] => (real-path-deleted)/wp-content/themes/supermassive/lib/inc/options.php
[line] => 10
)
我想我可以使用两种不同的策略之一来解决这个问题:
1。停止导致错误运行的不必要的wordpress代码。
error_get_last()
返回的错误。哪一个是最好的,我将如何实现它?