Bonjour.
Je poste ici car je peux avoir un problème dû à mon hébergeur(OVH) bien que l’on
puisse aussi suspecter une erreur dans le code de l’extension.
J’ai voulu commencer à utiliser les notes de frais mais je suis systématiquement en
erreur quand je veux enregistrer une modification (configuration des comptes, nouvelle
note defrais).
D’autres ont-il rencontré ce problème ? Comment a -t-il été résolu ?
Merci d’avance pour votre aide.
Jean-Michel Parot
Une erreur s'est produite
RuntimeException
Erreur dans '…/modules/expenses_claims/new.html' :
line 34: function 'redirect' has returned an error: Warning: Undefined array key
"redirect"
Parameters: (
'to' => './details.html?key=00ea901a-e51c-4a9f-a3b2-4fe9d9ffdc08',
)
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:341
337 $message = sprintf("Erreur dans '%s' :\n%s",
$path, $e->getMessage());
338
339 if (!$is_user_code) {
340 // We want errors in shipped code to be reported, it is not
normal
341 throw new \RuntimeException($message, 0, $e);
342 }
343 elseif (Session::getInstance()->isAdmin()) {
344 // Report error to admin with the highlighted line
345 $this->error($e, $message);
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:371
→ Paheko\UserTemplate\UserTemplate->display (0 arg.)
367 {
368 ob_start();
369
370 try {
371 $this->display();
372 }
373 catch (\Throwable $e) {
374 ob_end_clean();
375 throw $e;
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:469
→ Paheko\UserTemplate\UserTemplate->fetch (0 arg.)
465 if (!self::isTemplate($path)) {
466 throw new \InvalidArgumentException('Not a valid template file
extension: ' . $this->path);
467 }
468
469 $content = $this->fetch();
470
471 $this->dumpHeaders();
472
473 if ($this->getContentType() == 'application/pdf') {
in .../include/lib/Paheko/Entities/Module.php:547
→ Paheko\UserTemplate\UserTemplate->serve (1 arg.)
0
array(2) {
["uri"]=> string(26) "m/expenses_claims/new.html"
["page"]=> NULL
}
543 return;
544 }
545 else {
546 $ut = $this->template($path);
547 $ut->serve($params);
548 }
549
550 return;
551 }
in .../include/lib/Paheko/UserTemplate/Modules.php:347
→ Paheko\Entities\Module->serve (3 arg.)
$path
string(8) "new.html"
$has_local_file
bool(false)
$params
array(2) {
["uri"]=> string(26) "m/expenses_claims/new.html"
["page"]=> NULL
}
343 http_response_code(404);
344 throw new UserException('This path does not exist,
sorry.');
345 }
346
347 $module->serve($path, $has_local_file, compact('uri',
'page'));
348 }
349
350 static public function import(string $path, bool $overwrite = false): ?Module
351 {
in .../include/lib/Paheko/Web/Router.php:149
→ Paheko\UserTemplate\Modules::route (1 arg.)
$uri
string(26) "m/expenses_claims/new.html"
145 }
146 }
147
148 // Let modules handle the request
149 Modules::route($uri);
150 }
151
152 static public function routeFile(string $uri): bool
153 {
in .../www/_route.php:59
→ Paheko\Web\Router::route (0 arg.)
55 return;
56}
57
58// Call router
59Router::route();
60
KD2\Brindille_Exception
line 34: function 'redirect' has returned an error: Warning: Undefined array key
"redirect"
Parameters: (
'to' => './details.html?key=00ea901a-e51c-4a9f-a3b2-4fe9d9ffdc08',
)
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:641
637 catch (UserException $e) {
638 throw $e;
639 }
640 catch (\Exception $e) {
641 throw new Brindille_Exception(sprintf("line %d: function
'%s' has returned an error: %s\nParameters: %s", $line, $name,
$e->getMessage(), substr(var_export($params, true), 6)), 0, $e);
642 }
643 }
644
645 public function setParent(UserTemplate $tpl)
in .../data/cache/shared/utemplates/009bf0aa0e60040d2200f01787eb5710ce846487.php:24
→ Paheko\UserTemplate\UserTemplate->_callFunction (3 arg.)
$name
string(8) "redirect"
$params
array(1) {
["to"]=> string(55)
"./details.html?key=00ea901a-e51c-4a9f-a3b2-4fe9d9ffdc08"
}
$line
int(34)
20 <?=$this->_callFunction('assign', ['user_id'
=> $this->get('logged_user.id'), 'user_name' =>
$this->get('logged_user._name')], 20)?>
21 <?php endif; ?>
22
23 <?=$this->_callFunction('save', ['validate_schema' =>
'./claim.schema.json', 'key' => $this->get('key'),
'number' => $this->get('new_number'), 'type' =>
'claim', 'label' => $this->callModifier('or', 23,
$this->callModifier('trim', 23, $this->get('_POST.label')),
NULL), 'date' => $this->callModifier('date_format', 23,
$this->get('now'), '%Y-%m-%d'), 'user_id' =>
$this->get('user_id'), 'user_name' =>
$this->get('user_name'), 'status' => 'draft'],
23)?>
24 <?=$this->_callFunction('redirect', ['to' =>
$this->callModifier('args', 34, './details.html?key=%s',
$this->get('key'))], 34)?>
25<?php endforeach; } catch (\Paheko\UserException $e) {
$this->assign('form_errors', [$e->getMessage()]); } endif; ?>
26
27<?=$this->_callFunction('admin_header', ['title' =>
'Nouvelle note de frais'], 37)?>
28
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:305
→ include (1 arg.)
0
string(77)
".../data/cache/shared/utemplates/009bf0aa0e60040d2200f01787eb5710ce846487.php"
301 }
302
303 try {
304 if (file_exists($compiled_path) &&
filemtime($compiled_path) >= $this->modified) {
305 $return = include($compiled_path);
306
307 if ($return === 'STOP') {
308 exit;
309 }
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:371
→ Paheko\UserTemplate\UserTemplate->display (0 arg.)
367 {
368 ob_start();
369
370 try {
371 $this->display();
372 }
373 catch (\Throwable $e) {
374 ob_end_clean();
375 throw $e;
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:469
→ Paheko\UserTemplate\UserTemplate->fetch (0 arg.)
465 if (!self::isTemplate($path)) {
466 throw new \InvalidArgumentException('Not a valid template file
extension: ' . $this->path);
467 }
468
469 $content = $this->fetch();
470
471 $this->dumpHeaders();
472
473 if ($this->getContentType() == 'application/pdf') {
in .../include/lib/Paheko/Entities/Module.php:547
→ Paheko\UserTemplate\UserTemplate->serve (1 arg.)
0
array(2) {
["uri"]=> string(26) "m/expenses_claims/new.html"
["page"]=> NULL
}
543 return;
544 }
545 else {
546 $ut = $this->template($path);
547 $ut->serve($params);
548 }
549
550 return;
551 }
in .../include/lib/Paheko/UserTemplate/Modules.php:347
→ Paheko\Entities\Module->serve (3 arg.)
$path
string(8) "new.html"
$has_local_file
bool(false)
$params
array(2) {
["uri"]=> string(26) "m/expenses_claims/new.html"
["page"]=> NULL
}
343 http_response_code(404);
344 throw new UserException('This path does not exist,
sorry.');
345 }
346
347 $module->serve($path, $has_local_file, compact('uri',
'page'));
348 }
349
350 static public function import(string $path, bool $overwrite = false): ?Module
351 {
in .../include/lib/Paheko/Web/Router.php:149
→ Paheko\UserTemplate\Modules::route (1 arg.)
$uri
string(26) "m/expenses_claims/new.html"
145 }
146 }
147
148 // Let modules handle the request
149 Modules::route($uri);
150 }
151
152 static public function routeFile(string $uri): bool
153 {
in .../www/_route.php:59
→ Paheko\Web\Router::route (0 arg.)
55 return;
56}
57
58// Call router
59Router::route();
60
PHP error
Warning: Undefined array key "redirect"
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:635
631 }
632
633 public function _callFunction(string $name, array $params, int $line) {
634 try {
635 return call_user_func($this->_functions[$name], $params, $this,
$line);
636 }
637 catch (UserException $e) {
638 throw $e;
639 }
in .../data/cache/shared/utemplates/009bf0aa0e60040d2200f01787eb5710ce846487.php:24
→ Paheko\UserTemplate\UserTemplate->_callFunction (3 arg.)
$name
string(8) "redirect"
$params
array(1) {
["to"]=> string(55)
"./details.html?key=00ea901a-e51c-4a9f-a3b2-4fe9d9ffdc08"
}
$line
int(34)
20 <?=$this->_callFunction('assign', ['user_id'
=> $this->get('logged_user.id'), 'user_name' =>
$this->get('logged_user._name')], 20)?>
21 <?php endif; ?>
22
23 <?=$this->_callFunction('save', ['validate_schema' =>
'./claim.schema.json', 'key' => $this->get('key'),
'number' => $this->get('new_number'), 'type' =>
'claim', 'label' => $this->callModifier('or', 23,
$this->callModifier('trim', 23, $this->get('_POST.label')),
NULL), 'date' => $this->callModifier('date_format', 23,
$this->get('now'), '%Y-%m-%d'), 'user_id' =>
$this->get('user_id'), 'user_name' =>
$this->get('user_name'), 'status' => 'draft'],
23)?>
24 <?=$this->_callFunction('redirect', ['to' =>
$this->callModifier('args', 34, './details.html?key=%s',
$this->get('key'))], 34)?>
25<?php endforeach; } catch (\Paheko\UserException $e) {
$this->assign('form_errors', [$e->getMessage()]); } endif; ?>
26
27<?=$this->_callFunction('admin_header', ['title' =>
'Nouvelle note de frais'], 37)?>
28
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:305
→ include (1 arg.)
0
string(77)
".../data/cache/shared/utemplates/009bf0aa0e60040d2200f01787eb5710ce846487.php"
301 }
302
303 try {
304 if (file_exists($compiled_path) &&
filemtime($compiled_path) >= $this->modified) {
305 $return = include($compiled_path);
306
307 if ($return === 'STOP') {
308 exit;
309 }
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:371
→ Paheko\UserTemplate\UserTemplate->display (0 arg.)
367 {
368 ob_start();
369
370 try {
371 $this->display();
372 }
373 catch (\Throwable $e) {
374 ob_end_clean();
375 throw $e;
in .../include/lib/Paheko/UserTemplate/UserTemplate.php:469
→ Paheko\UserTemplate\UserTemplate->fetch (0 arg.)
465 if (!self::isTemplate($path)) {
466 throw new \InvalidArgumentException('Not a valid template file
extension: ' . $this->path);
467 }
468
469 $content = $this->fetch();
470
471 $this->dumpHeaders();
472
473 if ($this->getContentType() == 'application/pdf') {
in .../include/lib/Paheko/Entities/Module.php:547
→ Paheko\UserTemplate\UserTemplate->serve (1 arg.)
0
array(2) {
["uri"]=> string(26) "m/expenses_claims/new.html"
["page"]=> NULL
}
543 return;
544 }
545 else {
546 $ut = $this->template($path);
547 $ut->serve($params);
548 }
549
550 return;
551 }
in .../include/lib/Paheko/UserTemplate/Modules.php:347
→ Paheko\Entities\Module->serve (3 arg.)
$path
string(8) "new.html"
$has_local_file
bool(false)
$params
array(2) {
["uri"]=> string(26) "m/expenses_claims/new.html"
["page"]=> NULL
}
343 http_response_code(404);
344 throw new UserException('This path does not exist,
sorry.');
345 }
346
347 $module->serve($path, $has_local_file, compact('uri',
'page'));
348 }
349
350 static public function import(string $path, bool $overwrite = false): ?Module
351 {
in .../include/lib/Paheko/Web/Router.php:149
→ Paheko\UserTemplate\Modules::route (1 arg.)
$uri
string(26) "m/expenses_claims/new.html"
145 }
146 }
147
148 // Let modules handle the request
149 Modules::route($uri);
150 }
151
152 static public function routeFile(string $uri): bool
153 {
in .../www/_route.php:59
→ Paheko\Web\Router::route (0 arg.)
55 return;
56}
57
58// Call router
59Router::route();
60
Context
date
2024-03-28T10:42:12+01:00
duration
114.05301094055
environment
development
hostname
adherents.adpl-lande.fr
http_files
array(0) { }
http_method
POST
http_post
array(4) { ["user"]=> array(1) { [41]=> string(10)
"***HIDDEN***" } ["label"]=> string(53) "***HIDDEN***"
["save"]=> string(1) "***HIDDEN***"
["ct_b945f3a94b8baa61f41d51ec7ca79388cba9d66a"]=> string(87)
"***HIDDEN***" }
http_referrer
https://adherents.adpl-lande.fr/m/expenses_claims/new.html
http_user_agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/123.0.0.0 Safari/537.36
id
2wal6whi
language
PHP 8.2.10
memory_peak
2097152
memory_used
2097152
os
Linux
paheko_data_root
/home/adplland/adherents/data
paheko_version
1.3.6
php_sapi
fpm-fcgi
remote_ip
86.228.56.40
root_directory
/home/adplland/adherents
server_addr
10.13.20.24
user_addr
86.228.56.40
url
https://adherents.adpl-lande.fr/m/expenses_claims/new.html
OK, c'est clair.
Merci.
-----Message d'origine-----
De : BohwaZ/Paheko <bohwaz@paheko.cloud>
Envoyé : jeudi 28 mars 2024 16:32
À : hebergement@paheko.cloud
Objet : Re: [hebergement] Problème avec l'extension "notes de frais"
> Ça a réglé le problème. Je m'occuperai du cache plus souvent !
Normalement il est vidé automatiquement lors d'une mise à jour, mais il y a pu y
avoir un souci.
> J'ai proposé, comme je l'avais dit, au bureau (et à voir avec le CA)
> de migrer sur Paheko.cloud. Après nos échanges, j'ai compris que je
> n'aurai pas d'accès FTP. Comment fait-on pour vider le cache par
> exemple ?
Tu n'as pas besoin d'y toucher, et sur Paheko.cloud s'il y a un souci de ce
genre c'est moi qui m'occupe de le régler :)
> Pour sauver le code d'une extension que j'ai adaptée aux besoins de
> l'asso (facturation) ou pour le recharger après une mise à jour Paheko
> ?
Tu clique sur le bouton "Exporter ce module" :) Pas besoin de recharger après
une mise à jour.
> Et pour charger le code de plugins ou modules privés (HTML, CSS, PHP,
> Brindille) ou charger le code du site web qui sera porté ?
Le site web est un module, tu peux donc juste l'exporter depuis ton installation
locale et l'importer sur Paheko.cloud.
Par contre tu ne pourra pas faire de PHP bien sûr, uniquement HTML/CSS/Brindille.
Tu ne pourra pas non plus installer des plugins tiers (qui sont en PHP), uniquement des
modules. Détails ici :
https://fossil.kd2.org/paheko/wiki?name=Extensions