File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -54,25 +54,29 @@ public function __toString(): string
5454 */
5555 public function getValue (): string
5656 {
57-
5857 if (!$ this ->hasBeenEncoded ) {
5958 $ this ->hasBeenEncoded = true ;
60-
6159 if ($ this ->encode ) {
60+ // I will rather escape qoutes then encode them in prep is on
6261 $ this ->value = Encode::value ($ this ->value )->encode (function ($ val ) {
63- if ($ this ->prep ) {
64- $ val = Connect::prep ($ val );
65- }
6662 return $ val ;
6763 }, ($ this ->prep ? ENT_NOQUOTES : ENT_QUOTES ))->get ();
64+
6865 } else {
69- if ($ this ->prep ) {
66+ if (is_string ( $ this ->value ) ) {
7067 $ this ->value = Connect::prep ($ this ->value );
7168 }
7269 }
73- if (is_array ($ this ->value )) {
74- $ this ->value = json_encode ($ this ->value );
70+ if ($ this ->jsonEncode && is_array ($ this ->value )) {
71+ // If prep is on then escape after json_encode,
72+ // otherwise json encode will possibly escape the escaped value
73+ $ this ->value = json_encode ($ this ->value , JSON_UNESCAPED_SLASHES );
7574 }
75+
76+ if ($ this ->prep ) {
77+ $ this ->value = Connect::prep ($ this ->value );
78+ }
79+
7680 if ($ this ->enclose ) {
7781 $ this ->value = "' {$ this ->value }' " ;
7882 }
You can’t perform that action at this time.
0 commit comments