Skip to content

Commit d4c48c3

Browse files
committed
Handle double quotes, backslashes, and new lines in arguments
See #33883 (comment)
1 parent b22e853 commit d4c48c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

projects/plugins/jetpack/class.jetpack-cli.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -2011,17 +2011,17 @@ public function block( $args, $assoc_args ) {
20112011
'block-block-json',
20122012
array(
20132013
'slug' => $slug,
2014-
'title' => $title,
2014+
'title' => addcslashes( $title, '\n"\\' ),
20152015
'description' => isset( $assoc_args['description'] )
2016-
? $assoc_args['description']
2017-
: $title,
2016+
? addcslashes( $assoc_args['description'], '\n"\\' )
2017+
: addcslashes( $title, '\n"\\' ),
20182018
'nextVersion' => $next_version,
20192019
'keywords' => isset( $assoc_args['keywords'] )
20202020
? implode(
20212021
',',
20222022
array_map(
20232023
function ( $keyword ) {
2024-
return '"' . trim( $keyword ) . '"';
2024+
return '"' . trim( addcslashes( $keyword, '\n"\\' ) ) . '"';
20252025
},
20262026
array_slice( explode( ',', $assoc_args['keywords'] ), 0, 3 )
20272027
)

0 commit comments

Comments
 (0)