这是一个 SmartJobBoard 软件,我不知道如何生成以下错误:
Fatal error: Call to a member function getType() on a non-object in /home/_web/html/engjobs/system/lib/classifieds/SearchEngine/SearchSqlTranslator.php on line 21
我去找这个文件SearchSqlTranslator.php
,下面的代码是具有getType的函数:
function buildSQLQuery($criteria, &$valid_criterion_number, $sorting_fields, $inner_join = false, $count = false, $relevance = false)
{
foreach ($criteria['common'] as $crit) {
foreach($crit as $criterion) {
$type = $criterion->getProperty()->getType();
if ($criterion->getProperty() !== null && $type == 'monetary') {
$this->isMonetary = true;
break;
}
if ($criterion->getProperty() !== null && $criterion->getProperty()->isComplex()) {
$this->isComplex = true;
break;
}
}
}
if ($relevance)
$this->isRelevance = true;
$sorting_block = $this->_getSortingStatement($sorting_fields);
if ($count)
$select_block = $this->_getSelectCountStatement();
elseif ($relevance)
$select_block = $this->_getSelectRelevanceStatement($relevance);
else
$select_block = $this->_getSelectStatement();
$from_block = $this->_getFromStatement($inner_join);
$where_block = $this->_getWhereStatement($criteria);
$group_block = '';
if (SJB_DB::table_exists($this->object_table_prefix.'_properties'))
$group_block = $this->_getGroupStatement();
$having_block = '';
if ($this->valid_criterion_number != 0 && !empty($group_block)) {
$having_block = " HAVING `count` = {$this->valid_criterion_number} ";
}
$limit_block = '';
if ($this->limit)
$limit_block = ' LIMIT ' . $this->limit;
$valid_criterion_number = $this->valid_criterion_number;
return $select_block . $from_block . $where_block . $group_block . $having_block . $sorting_block . $limit_block;
}
现在我已经看到了类文件,很明显该函数是从其他地方调用的。那么我应该如何找到哪个类正在调用这个函数呢?
我是否必须猜测并遍历每个类文件才能找到它的位置,或者我是否可以使用类似grep
on shell 的东西来潜在地找到这个函数及其类?
似乎有多个层(至少 6-7 次),如果发生类似这样的错误,很难追溯。有没有办法系统地调试这类问题?
上面的函数也是其中的一部分,class SJB_SearchSqlTranslator
它不会扩展到任何其他类。
Smart Job Board 脚本使用 Zend 作为其库,但似乎他们已经创建了自己的框架。