From d8cb0f9764e481c5f8a0ec52d1393deb36b62326 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 16 Apr 2019 18:20:25 +0200 Subject: [PATCH] deprecated the 3rd argument of Sandbox error classes --- CHANGELOG | 2 +- src/Sandbox/SecurityNotAllowedFilterError.php | 3 +++ src/Sandbox/SecurityNotAllowedFunctionError.php | 3 +++ src/Sandbox/SecurityNotAllowedMethodError.php | 3 +++ src/Sandbox/SecurityNotAllowedPropertyError.php | 3 +++ src/Sandbox/SecurityNotAllowedTagError.php | 3 +++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a5752c590..d064262b4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,6 @@ * 2.8.1 (2019-XX-XX) - * deprecated passing a 4th and 5th arguments to the Sandbox exception classes + * deprecated passing a 3rd, 4th, and 5th arguments to the Sandbox exception classes * deprecated Node::setTemplateName() in favor of Node::setSourceContext() * 2.8.0 (2019-04-16) diff --git a/src/Sandbox/SecurityNotAllowedFilterError.php b/src/Sandbox/SecurityNotAllowedFilterError.php index cfebec632..767ec5b3d 100644 --- a/src/Sandbox/SecurityNotAllowedFilterError.php +++ b/src/Sandbox/SecurityNotAllowedFilterError.php @@ -24,6 +24,9 @@ class SecurityNotAllowedFilterError extends SecurityError public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null) { + if (-1 !== $lineno) { + @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); + } if (null !== $filename) { @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); } diff --git a/src/Sandbox/SecurityNotAllowedFunctionError.php b/src/Sandbox/SecurityNotAllowedFunctionError.php index 0b533ce85..5a3013998 100644 --- a/src/Sandbox/SecurityNotAllowedFunctionError.php +++ b/src/Sandbox/SecurityNotAllowedFunctionError.php @@ -24,6 +24,9 @@ class SecurityNotAllowedFunctionError extends SecurityError public function __construct(string $message, string $functionName, int $lineno = -1, string $filename = null, \Exception $previous = null) { + if (-1 !== $lineno) { + @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); + } if (null !== $filename) { @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); } diff --git a/src/Sandbox/SecurityNotAllowedMethodError.php b/src/Sandbox/SecurityNotAllowedMethodError.php index a5197fca1..c8103ea0f 100644 --- a/src/Sandbox/SecurityNotAllowedMethodError.php +++ b/src/Sandbox/SecurityNotAllowedMethodError.php @@ -25,6 +25,9 @@ class SecurityNotAllowedMethodError extends SecurityError public function __construct(string $message, string $className, string $methodName, int $lineno = -1, string $filename = null, \Exception $previous = null) { + if (-1 !== $lineno) { + @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); + } if (null !== $filename) { @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); } diff --git a/src/Sandbox/SecurityNotAllowedPropertyError.php b/src/Sandbox/SecurityNotAllowedPropertyError.php index d91f4f683..d148f08d2 100644 --- a/src/Sandbox/SecurityNotAllowedPropertyError.php +++ b/src/Sandbox/SecurityNotAllowedPropertyError.php @@ -25,6 +25,9 @@ class SecurityNotAllowedPropertyError extends SecurityError public function __construct(string $message, string $className, string $propertyName, int $lineno = -1, string $filename = null, \Exception $previous = null) { + if (-1 !== $lineno) { + @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); + } if (null !== $filename) { @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); } diff --git a/src/Sandbox/SecurityNotAllowedTagError.php b/src/Sandbox/SecurityNotAllowedTagError.php index 10a81728c..25f636113 100644 --- a/src/Sandbox/SecurityNotAllowedTagError.php +++ b/src/Sandbox/SecurityNotAllowedTagError.php @@ -24,6 +24,9 @@ class SecurityNotAllowedTagError extends SecurityError public function __construct(string $message, string $tagName, int $lineno = -1, string $filename = null, \Exception $previous = null) { + if (-1 !== $lineno) { + @trigger_error(sprintf('Passing $lineno as a 3th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); + } if (null !== $filename) { @trigger_error(sprintf('Passing $filename as a 4th argument of the %s constructor is deprecated since Twig 2.8.1.', __CLASS__), E_USER_DEPRECATED); }