2828use function is_array ;
2929use function is_file ;
3030use function is_string ;
31+ use function json_encode ;
3132use function max ;
3233use function mb_stripos ;
3334use function mb_strlen ;
@@ -595,7 +596,7 @@ private function getTextarea(
595596 . ' cols=" ' . $ textareaCols . '" '
596597 . ' dir=" ' . $ textDir . '" '
597598 . ' id="field_ ' . $ idindex . '_3" '
598- . ($ onChangeClause ? ' ' . $ onChangeClause : '' )
599+ . ($ onChangeClause ? ' onchange=" ' . htmlspecialchars ( $ onChangeClause, ENT_COMPAT ) . ' " ' : '' )
599600 . ' tabindex=" ' . ($ tabindex + $ tabindexForValue ) . '" '
600601 . ' data-type=" ' . $ dataType . '"> '
601602 . $ specialCharsEncoded
@@ -715,7 +716,7 @@ private function getHtmlInput(
715716 . ($ readOnly ? ' readonly="readonly" ' : '' )
716717 . ($ inputMinMax ? ' ' . $ inputMinMax : '' )
717718 . ' data-type=" ' . $ dataType . '" '
718- . ' class=" ' . $ theClass . '" ' . $ onChangeClause
719+ . ' class=" ' . $ theClass . '" onchange=" ' . htmlspecialchars ( $ onChangeClause, ENT_COMPAT ) . ' " '
719720 . ' tabindex=" ' . ($ tabindex + $ tabindexForValue ) . '" '
720721 . ($ isInteger ? ' inputmode="numeric" ' : '' )
721722 . ' id="field_ ' . $ idindex . '_3"> ' ;
@@ -1959,7 +1960,6 @@ public function getHtmlForInsertEditFormHeader($hasBlobField, $isUpload): string
19591960 * @param array $commentsMap comments map
19601961 * @param bool $timestampSeen whether timestamp seen
19611962 * @param ResultInterface $currentResult current result
1962- * @param string $chgEvtHandler javascript change event handler
19631963 * @param string $jsvkey javascript validation key
19641964 * @param string $vkey validation key
19651965 * @param bool $insertMode whether insert mode
@@ -1988,7 +1988,6 @@ private function getHtmlForInsertEditFormColumn(
19881988 array $ commentsMap ,
19891989 $ timestampSeen ,
19901990 ResultInterface $ currentResult ,
1991- $ chgEvtHandler ,
19921991 $ jsvkey ,
19931992 $ vkey ,
19941993 $ insertMode ,
@@ -2035,10 +2034,9 @@ private function getHtmlForInsertEditFormColumn(
20352034 }
20362035
20372036 //Call validation when the form submitted...
2038- $ onChangeClause = $ chgEvtHandler
2039- . "= \"return verificationsAfterFieldChange(' "
2040- . Sanitize::escapeJsString ($ fieldHashMd5 ) . "', ' "
2041- . Sanitize::escapeJsString ($ jsvkey ) . "',' " . $ column ['pma_type ' ] . "') \"" ;
2037+ $ onChangeClause = 'return verificationsAfterFieldChange( '
2038+ . json_encode ($ fieldHashMd5 ) . ', '
2039+ . json_encode ($ jsvkey ) . ', ' . json_encode ($ column ['pma_type ' ]) . ') ' ;
20422040
20432041 // Use an MD5 as an array index to avoid having special characters
20442042 // in the name attribute (see bug #1746964 )
@@ -2340,7 +2338,6 @@ private function isColumnBinary(array $column, bool $isUpload): bool
23402338 * @param array $commentsMap comments map
23412339 * @param bool $timestampSeen whether timestamp seen
23422340 * @param ResultInterface $currentResult current result
2343- * @param string $chgEvtHandler javascript change event handler
23442341 * @param string $jsvkey javascript validation key
23452342 * @param string $vkey validation key
23462343 * @param bool $insertMode whether insert mode
@@ -2367,7 +2364,6 @@ public function getHtmlForInsertEditRow(
23672364 array $ commentsMap ,
23682365 $ timestampSeen ,
23692366 ResultInterface $ currentResult ,
2370- $ chgEvtHandler ,
23712367 $ jsvkey ,
23722368 $ vkey ,
23732369 $ insertMode ,
@@ -2420,7 +2416,6 @@ public function getHtmlForInsertEditRow(
24202416 $ commentsMap ,
24212417 $ timestampSeen ,
24222418 $ currentResult ,
2423- $ chgEvtHandler ,
24242419 $ jsvkey ,
24252420 $ vkey ,
24262421 $ insertMode ,
0 commit comments