Bläddra i källkod

Minz provide action name in controller exception (#3624)

Contributes to https://github.com/FreshRSS/FreshRSS/issues/3584
Alexandre Alapetite 4 år sedan
förälder
incheckning
9e8a17655a
1 ändrade filer med 4 tillägg och 1 borttagningar
  1. 4 1
      lib/Minz/ActionException.php

+ 4 - 1
lib/Minz/ActionException.php

@@ -1,7 +1,10 @@
 <?php
 class Minz_ActionException extends Minz_Exception {
 	public function __construct ($controller_name, $action_name, $code = self::ERROR) {
-		$message = 'Invalid action name for controller ' . $controller_name;
+		// Just for security, as we are not supposed to get non-alphanumeric characters.
+		$action_name = rawurlencode($action_name);
+
+		$message = "Invalid action name “${action_name}” for controller “${controller_name}”.";
 		parent::__construct ($message, $code);
 	}
 }