HI J'ai installé yii2 et écrit l'application. J'ai utilisé git. Lorsque je transfère l'application sur le serveur. Tout a l'air bien. Mais quand j'essaie de me connecter Je reçois ce message:Yii2 - Propriété inconnue - yii base UnknownPropertyException Obtention de la propriété inconnue: yii web Application :: security
Unknown Property – yii\base\UnknownPropertyException
Obtenir propriété inconnue: yu \ web \ Application :: sécurité
1. in C:\httpd\omg\omg-new\vendor\yiisoft\yii2\base\Component.php at line 142
133134135136137138139140141142143144145146147148149150151
foreach ($this->_behaviors as $behavior) {
if ($behavior->canGetProperty($name)) {
return $behavior->$name;
}
}
}
if (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
} else {
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}
}
/**
* Sets the value of a component property.
* This method will check in the following order and act accordingly:
*
* - a property defined by a setter: set the property value
* - an event in the format of "on xyz": attach the handler to the event "xyz"
2. in C:\httpd\omg\omg-new\vendor\yiisoft\yii2\di\ServiceLocator.php – yii\base\Component::__get() at line 72
3. in C:\httpd\omg\omg-new\common\models\User.php – yii\di\ServiceLocator::__get() at line 154
148149150151152153154155156157158159160
*
* @param string $password password to validate
* @return boolean if password provided is valid for current user
*/
public function validatePassword($password)
{
return Yii::$app->security->validatePassword($password, $this->password_hash);
}
/**
* Generates password hash from password and sets it to the model
*
* @param string $password
4. in C:\httpd\omg\omg-new\common\models\LoginForm.php – common\models\User::validatePassword() at line 45
39404142434445464748495051
* @param array $params the additional name-value pairs given in the rule
*/
public function validatePassword($attribute, $params)
{
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError($attribute, 'Incorrect username or password.');
}
}
}
/**
Quel serait le problème? J'ai couru mise à jour du compositeur. Pourquoi seule la sécurité est manquante?
Y a-t-il des barres obliques manquantes devant votre commentaire sur plusieurs lignes? Quel est le message d'erreur que vous obtenez, je ne vois que du code? Le code est-il le message d'erreur? –
Oui slash manquant c'est yii exception, ajouté une description d'exception détaillée. – MrGapo