As-tu eu un changement de version php ou c'est juste un changement de nom de domaine/ip ?
Bonjour à tous,
Voilà j'ai voulu installer mon site sur une nouvelle ip et j'ai plusieurs erreurs dont celle-ci que je n'arrive pas à résoudre:
Non-static method SessionComponent::read() should not be called statically, assuming $this from incompatible context [APP/View/Servers/confirm.ctp, line 20]
Serait-il possible d'avoir un peu d'aide s'il vous plait.
Merci d'avance,
Cordialement,
10 réponses
J'ai certainement eu un changement de version php mais je ne vois pas réellement le rapport.
Après vérification mon ancien dédié était en version : PHP Version 5.3.10-1ubuntu3.10
et le nouveau est en version : PHP Version 5.4.4-14+deb7u8
Mais je ne vois pas vraiment comment résoudre le problème ...
Et quelle est ta version de cakephp ?
J'ai la version 2.0.
colle nous ta view confirm.ctp... J'ai jamais eu cette erreur et google a pas l'air de connaitre non plus =) (tu es un précurseur :) )
Pareil, j'ai beau cherché sur google je n'ai rien trouvé de semblable ... C'est bien la première fois que sa m'arrive et je n'arrive pas à cerner le problème depuis 4 jours ...
<table class="tblr" width="100%" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="33.3%">Serveur</th>
<th width="33.3%">Durée</th>
<th width="33.3%">Coût</th>
</tr>
</thead>
<tbody>
<?php foreach ($servers as $k => $v): $v = current($v); ?>
<tr>
<td align="center"><?php echo $v'hostname']; ?></td>
<td align="center"><?php echo SessionComponent::read('Commande.servers.'.$v'id']) == 1 ? 'Mensuel' : 'Trimestriel'; ?></td>
<td align="center"><?php echo $v'price'.(SessionComponent::read('Commande.servers.'.$v'id']) == 1 ? '' : '_3')]; ?></td>
</tr>
<?php $total += $v'price'.(SessionComponent::read('Commande.servers.'.$v'id']) == 1 ? '' : '_3')]; ?>
<?php endforeach ?>
</tbody>
</table>
</div>
<table align="right" class="tblr" width="30%" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="33.3%">Coût total : <strong><?php echo $total; ?></strong></th>
</tr>
</thead>
<thead>
<tr>
<th width="33.3%">Vous disposez de <strong><?php echo $this->Session->read('Auth.User.credits'); ?></strong></th>
</tr>
</thead>
<thead>
<tr>
<th width="33.3%">Il vous restera, après achat, <strong><?php echo $this->Session->read('Auth.User.credits') - $total; ?></strong></th>
</tr>
</thead>
</table>
<p style="text-align:right;">
<?php echo $this->Html->link("Confirmer",array('action'=>'buy',2),array('class'=>'button')); ?>
</p>
Bonsoir,
Peux tu mettre un titre de sujet plus explicite stp ?
Tu as essayé en remplaçant SessionComponent::read par CakeSession::read ?
Cordialement
Bonsoir,
J'ai remplacé par ce que vous avez mis mais j'ai de nouvelles erreurs:
(je sais d'ou vient l'erreur du cakemail mais par contre pour ce qui est du reste je ne vois pas ...)
Error: An Internal Error Has Occurred.
STACK TRACE
CORE/Cake/Network/Email/MailTransport.php line 51 ? MailTransport->_mail(string, string, string, string, null)
CORE/Cake/Network/Email/CakeEmail.php line 1121 ? MailTransport->send(CakeEmail)
APP/Model/Server.php line 70 ? CakeEmail->send(string)
APP/Controller/ServersController.php line 95 ? Server->buy(array)
[internal function] ? ServersController->buy(string)
CORE/Cake/Controller/Controller.php line 490 ? ReflectionMethod->invokeArgs(ServersController, array)
CORE/Cake/Routing/Dispatcher.php line 185 ? Controller->invokeAction(CakeRequest)
CORE/Cake/Routing/Dispatcher.php line 160 ? Dispatcher->_invoke(ServersController, CakeRequest, CakeResponse)
APP/webroot/index.php line 96 ? Dispatcher->dispatch(CakeRequest, CakeResponse)
Et voici le code de la ligne 84 à 103: (ServersController.php)
public function buy($step = 1){
if($step == 0){
$this->Session->delete('Commande');
}
if($step == 2){
$servers = $this->Session->read('Commande.servers');
if(empty($servers)){
$this->Session->setFlash("Vous ne pouvez pas ne commander aucun serveur","error");
$this->redirect($this->referer());
}
if($this->Server->buy($servers)){
$this->Session->setFlash("Votre commande a bien été pris en compte","success");
$this->redirect('/');
}else{
$this->Session->setFlash("Vous n'avez pas assez de crédits pour cette commande","error");
$this->redirect(array('action'=>'buy'));
}
}
Ca fonctionne ? au final ?