Hallo zusammen,
leider taucht beim eigenen Umbennen des Foren-Benutzernamens durch einen Nutzer unten stehender Fehler auf.
Jedes Mal, wenn eine Person ihren Namen in der Benutzerkonto-Verwaltung ändert und auf Absenden klickt, erscheint der folgende Fehler. Ruft man anschließend die Startseite des Forums auf, hat die Umbennung jedoch dennoch geklappt. - Ich würde also gerne nur diesen unschönen Fehler entfernen:
Code
<<<<<<<<106c484a404cabc3e7e25a62d6f3576d4639240f<<<<
Thu, 13 Oct 2016 07:02:36 +0000
Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET username = ?
WHERE userID = ?' at line 1
File: /var/www/wcf/lib/system/database/Database.class.php (231)
PHP version: 5.4.45-0+deb7u4
WCF version: 2.1.11 (Typhoon)
Request URI: /index.php?account-management/
Referrer: http://[...]/index.php?account-management/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0
Information: "<b>sql type:<\/b> wcf\\system\\database\\MySQLDatabase<br \/><b>sql error:<\/b> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET\t\tusername = ?\n\t\t\tWHERE\t\tuserID = ?' at line 1<br \/><b>sql error number:<\/b> 42000<br \/><b>sql version:<\/b> 5.5.50-0+deb7u2<br \/><b>sql query:<\/b> SELECT\t\tcms1_content_revision\n\t\t\tSET\t\tusername = ?\n\t\t\tWHERE\t\tuserID = ?<br \/>"
Stacktrace:
#0 /var/www/cms/lib/system/event/listener/UserRenameListener.class.php(40): wcf\system\database\Database->prepareStatement('SELECT\t\tcms1_co...')
#1 /var/www/wcf/lib/system/event/EventHandler.class.php(214): cms\system\event\listener\UserRenameListener->execute(Object(wcf\data\user\UserAction), 'wcf\\data\\user\\U...', 'rename', Array)
#2 /var/www/wcf/lib/data/user/UserAction.class.php(390): wcf\system\event\EventHandler->fireAction(Object(wcf\data\user\UserAction), 'rename')
#3 [internal function]: wcf\data\user\UserAction->update()
#4 /var/www/wcf/lib/data/AbstractDatabaseObjectAction.class.php(196): call_user_func(Array)
#5 /var/www/wcf/lib/form/AccountManagementForm.class.php(440): wcf\data\AbstractDatabaseObjectAction->executeAction()
#6 /var/www/wcf/lib/form/AbstractForm.class.php(63): wcf\form\AccountManagementForm->save()
#7 /var/www/wcf/lib/form/AbstractForm.class.php(114): wcf\form\AbstractForm->submit()
#8 /var/www/wcf/lib/form/AccountManagementForm.class.php(261): wcf\form\AbstractForm->readData()
#9 /var/www/wcf/lib/page/AbstractPage.class.php(273): wcf\form\AccountManagementForm->readData()
#10 /var/www/wcf/lib/form/AccountManagementForm.class.php(305): wcf\page\AbstractPage->show()
#11 /var/www/wcf/lib/page/AbstractPage.class.php(100): wcf\form\AccountManagementForm->show()
#12 /var/www/wcf/lib/system/request/Request.class.php(58): wcf\page\AbstractPage->__run()
#13 /var/www/wcf/lib/system/request/RequestHandler.class.php(139): wcf\system\request\Request->execute()
#14 /var/www/index.php(13): wcf\system\request\RequestHandler->handle('wbb')
#15 {main}
<<<<
Display More
Die Datei Database.class.php, in der der Fehler wohl liegt, sieht wie folgt aus:
PHP: Database.class.php
<?php
namespace wcf\system\database;
use wcf\system\benchmark\Benchmark;
use wcf\system\WCF;
/**
* Abstract implementation of a database access class using PDO.
*
* @author Marcel Werk
* @copyright 2001-2015 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.database
* @category Community Framework
*/
abstract class Database {
/**
* name of the class used for prepared statements
* @var string
*/
protected $preparedStatementClassName = 'wcf\system\database\statement\PreparedStatement';
/**
* name of the database editor class
* @var string
*/
protected $editorClassName = 'wcf\system\database\editor\DatabaseEditor';
/**
* sql server hostname
* @var string
*/
protected $host = '';
/**
* sql server post
* @var integer
*/
protected $port = 0;
/**
* sql server login name
* @var string
*/
protected $user = '';
/**
* sql server login password
* @var string
*/
protected $password = '';
/**
* database name
* @var string
*/
protected $database = '';
/**
* enables failsafe connection
* @var boolean
*/
protected $failsafeTest = false;
/**
* number of executed queries
* @var integer
*/
protected $queryCount = 0;
/**
* database editor object
* @var \wcf\system\database\editor\DatabaseEditor
*/
protected $editor = null;
/**
* pdo object
* @var \PDO
*/
protected $pdo = null;
/**
* amount of active transactions
* @var integer
*/
protected $activeTransactions = 0;
/**
* Creates a Dabatase Object.
*
* @param string $host SQL database server host address
* @param string $user SQL database server username
* @param string $password SQL database server password
* @param string $database SQL database server database name
* @param integer $port SQL database server port
*/
public function __construct($host, $user, $password, $database, $port, $failsafeTest = false) {
$this->host = $host;
$this->port = $port;
$this->user = $user;
$this->password = $password;
$this->database = $database;
$this->failsafeTest = $failsafeTest;
// connect database
$this->connect();
}
/**
* Connects to database server.
*/
abstract public function connect();
/**
* Returns ID from last insert.
*
* @param string $table
* @param string $field
* @return integer
*/
public function getInsertID($table, $field) {
try {
return $this->pdo->lastInsertId();
}
catch (\PDOException $e) {
throw new DatabaseException("Cannot fetch last insert id: " . $e->getMessage(), $this);
}
}
/**
* Initiates a transaction.
*
* @return boolean true on success
*/
public function beginTransaction() {
try {
if ($this->activeTransactions === 0) {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("BEGIN", Benchmark::TYPE_SQL_QUERY);
$result = $this->pdo->beginTransaction();
}
else {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("SAVEPOINT level".$this->activeTransactions, Benchmark::TYPE_SQL_QUERY);
$result = $this->pdo->exec("SAVEPOINT level".$this->activeTransactions) !== false;
}
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop();
$this->activeTransactions++;
return $result;
}
catch (\PDOException $e) {
throw new DatabaseException("Cannot begin transaction: " . $e->getMessage(), $this);
}
}
/**
* Commits a transaction and returns true if the transaction was successfull.
*
* @return boolean
*/
public function commitTransaction() {
if ($this->activeTransactions === 0) return false;
try {
$this->activeTransactions--;
if ($this->activeTransactions === 0) {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("COMMIT", Benchmark::TYPE_SQL_QUERY);
$result = $this->pdo->commit();
}
else {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("RELEASE SAVEPOINT level".$this->activeTransactions, Benchmark::TYPE_SQL_QUERY);
$result = $this->pdo->exec("RELEASE SAVEPOINT level".$this->activeTransactions) !== false;
}
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop();
return $result;
}
catch (\PDOException $e) {
throw new DatabaseException("Cannot commit transaction: " . $e->getMessage(), $this);
}
}
/**
* Rolls back a transaction and returns true if the rollback was successfull.
*
* @return boolean
*/
public function rollBackTransaction() {
if ($this->activeTransactions === 0) return false;
try {
$this->activeTransactions--;
if ($this->activeTransactions === 0) {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("ROLLBACK", Benchmark::TYPE_SQL_QUERY);
$result = $this->pdo->rollback();
}
else {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start("ROLLBACK TO SAVEPOINT level".$this->activeTransactions, Benchmark::TYPE_SQL_QUERY);
$result = $this->pdo->exec("ROLLBACK TO SAVEPOINT level".$this->activeTransactions) !== false;
}
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop();
return $result;
}
catch (\PDOException $e) {
throw new DatabaseException("Cannot rollback transaction: " . $e->getMessage(), $this);
}
}
/**
* Prepares a statement for execution and returns a statement object.
*
* @param string $statement
* @param integer $limit
* @param integer $offset
* @return \wcf\system\database\statement\PreparedStatement
*/
public function prepareStatement($statement, $limit = 0, $offset = 0) {
$statement = $this->handleLimitParameter($statement, $limit, $offset);
try {
$pdoStatement = $this->pdo->prepare($statement);
return new $this->preparedStatementClassName($this, $pdoStatement, $statement);
}
catch (\PDOException $e) {
throw new DatabaseException($e->getMessage(), $this, null, $statement);
}
}
/**
* Handles the limit and offset parameter in SELECT queries.
* This is a default implementation compatible to MySQL and PostgreSQL.
* Other database implementations should override this function.
*
* @param string $query
* @param integer $limit
* @param integer $offset
* @return string
*/
public function handleLimitParameter($query, $limit = 0, $offset = 0) {
if ($limit != 0) {
$query .= " LIMIT " . $limit . " OFFSET " . $offset;
}
return $query;
}
/**
* Returns the number of the last error.
*
* @return integer
*/
public function getErrorNumber() {
if ($this->pdo !== null) return $this->pdo->errorCode();
return 0;
}
/**
* Returns the description of the last error.
*
* @return string
*/
public function getErrorDesc() {
if ($this->pdo !== null) {
$errorInfoArray = $this->pdo->errorInfo();
if (isset($errorInfoArray[2])) return $errorInfoArray[2];
}
return '';
}
/**
* Gets the current database type.
*
* @return string
*/
public function getDBType() {
return get_class($this);
}
/**
* Escapes a string for use in sql query.
*
* @param string $string
* @return string
*/
public function escapeString($string) {
return addslashes($string);
}
/**
* Gets the sql version.
*
* @return string
*/
public function getVersion() {
try {
if ($this->pdo !== null) {
return $this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION);
}
}
catch (\PDOException $e) {}
return 'unknown';
}
/**
* Gets the database name.
*
* @return string
*/
public function getDatabaseName() {
return $this->database;
}
/**
* Returns the name of the database user.
*
* @return string user name
*/
public function getUser() {
return $this->user;
}
/**
* Returns the amount of executed sql queries.
*
* @return integer
*/
public function getQueryCount() {
return $this->queryCount;
}
/**
* Increments the query counter by one.
*/
public function incrementQueryCount() {
$this->queryCount++;
}
/**
* Returns a database editor object.
*
* @return \wcf\system\database\editor\DatabaseEditor
*/
public function getEditor() {
if ($this->editor === null) {
$this->editor = new $this->editorClassName($this);
}
return $this->editor;
}
/**
* Returns true if this database type is supported.
*
* @return boolean
*/
public static function isSupported() {
return false;
}
/**
* Sets default connection attributes.
*/
protected function setAttributes() {
$this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$this->pdo->setAttribute(\PDO::ATTR_CASE, \PDO::CASE_NATURAL);
$this->pdo->setAttribute(\PDO::ATTR_STRINGIFY_FETCHES, false);
}
}
Display More
Leider komme ich nicht hinter den Fehler.
Ich hoffe, dass ihr eine Idee habt, wie ich das Problem lösen kann.
Vielen Dank im Voraus.
LG
Philippoius