From 8f98a6d6f5ffc9c2b561aba59b646a5ae2a2ef49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 29 Aug 2016 21:45:03 +0300 Subject: [PATCH] php: Do not HTML escape patterns --- .../src/main/resources/php/api.mustache | 4 ++-- .../src/main/resources/php/model_generic.mustache | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index fb03a721e17..f039a6baa17 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -149,8 +149,8 @@ use \{{invokerPackage}}\ObjectSerializer; } {{/minimum}} {{#pattern}} - if ({{^required}}!is_null(${{paramName}}) && {{/required}}!preg_match("{{pattern}}", ${{paramName}})) { - throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.'); + if ({{^required}}!is_null(${{paramName}}) && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { + throw new \InvalidArgumentException('invalid value for "{{paramName}}" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.'); } {{/pattern}} diff --git a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache index c0ab1cd47e0..460c5c67419 100644 --- a/modules/swagger-codegen/src/main/resources/php/model_generic.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model_generic.mustache @@ -155,8 +155,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{/minimum}} {{#pattern}} - if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{pattern}}", $this->container['{{name}}'])) { - $invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{pattern}}."; + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{{pattern}}}", $this->container['{{name}}'])) { + $invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}."; } {{/pattern}} @@ -209,7 +209,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple } {{/minimum}} {{#pattern}} - if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { + if (!preg_match("{{{pattern}}}", $this->container['{{name}}'])) { return false; } {{/pattern}} @@ -270,8 +270,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple } {{/minimum}} {{#pattern}} - if (!preg_match("{{pattern}}", ${{name}})) { - throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.'); + if (!preg_match("{{{pattern}}}", ${{name}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{{pattern}}}.'); } {{/pattern}} {{/hasValidation}}