我正在尝试运行由其他团队开发的代码。我配置并运行了项目,但是我得到了对我来说是新的错误。
严格标准: DB_Statement_1::execute()的声明应该与第12行的/virtualhosts/lib起身/DB/Statement.1.php中的PDOStatement::execute($bound_input_params = NULL)兼容 严格标准: DB_Statement_1::fetch()的声明应该与第12行中/virtualhosts/lib起身/DB/Statement.1.php中的PDOStatement::fetch($how = NULL,$orientation = NULL,$offset = NULL)兼容
第12行在下面。
/**
* A statement class that implements DB_IStatement_1
* NOTE: in most cases, you should be type-hinting for DB_IStatement_1
* @author Andrew Minerd <andrew.minerd@sellingsource.com>
*/
following line is #12
class DB_Statement_1 extends PDOStatement implements DB_IStatement_1
{ public function execute(array $args = NULL)
{
// apparently, PDO counts the number of arguments to indicate missing
// optional parameters, rather than relying on a default value
$result = ($args !== NULL)
? parent::execute($args)
: parent::execute();
if ($result === FALSE)
{
throw new PDOException('Could not execute statement');
}
return $result;
}
/**
* Fetches a single row
*
* @param int $fetch_mode
* @return mixed
*/
public function fetch($fetch_mode = DB_IStatement_1::FETCH_ASSOC)
{
return parent::fetch($fetch_mode);
}在同一个包中有以下类。
DatabaseConfigPool.1.php MSSQLAdapter.1.php MySQL4Adapter.1.php ODBCConfig.1.php TransactionAbortedException.1.php
EmulatedPrepare.1.php MSSQLAdapterException.1.php MySQL4AdapterException.1.php PoolConfig.1.php TransactionManager.1.php
FailoverConfig.1.php MSSQLConfig.1.php MySQL4StatementAdapter.1.php Profiler Util
IConnection.1.php MSSQLConfig.2.php MySQLConfig.1.php Query.1.php Util.1.php
IDatabaseConfig.1.php MSSQLStatementAdapter.1.php MySQLiAdapter.1.php SQLiteConfig.1.php
IStatement.1.php MultiplexConfig.1.php MySQLiAdapterException.1.php Statement.1.php
[vendorapi@808680-app2 DB]$ nano Statement.1.php他们中的哪一个被推翻了。
感谢所有人
发布于 2016-11-07 13:19:46
这可能是由于PHP版本的升级,以及PHP如何处理PHP 5.4+中的不同错误。
首先,您可以禁用严格的错误以消除这样的错误:
error_reporting(E_ALL ^ E_STRICT);注意E_STRICT -这对于5.4+来说是新的
但是,如果您想保持严格的错误,您可以通过更改代码来消除它们。您需要确保重写类具有正确的原型/定义,以消除错误。
案件1)
class DB_Statement_1 extends PDOStatement implements DB_IStatement_1
{
public function execute($args = NULL) { ... }
....
}删除“数组”类型提示,因为父类没有“数组”类型提示,这将消除第一个错误等等。
https://stackoverflow.com/questions/40464223
复制相似问题