From 23cbfec581fcd389c249a85da4052abbb9d80869 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 8 Jul 2012 21:11:23 +0000 Subject: [PATCH] TinyMCE: don't throw fatal errors for malformed/invalid image caption shortcodes, props SergeyBiryukov, see #21145 git-svn-id: https://develop.svn.wordpress.org/trunk@21232 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/wpeditimage/editor_plugin_src.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js index c241158d32..f771fc9396 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js @@ -142,13 +142,16 @@ var id, cls, w, cap, div_cls, img, trim = tinymce.trim; id = b.match(/id=['"]([^'"]*)['"] ?/); - b = b.replace(id[0], ''); + if ( id ) + b = b.replace(id[0], ''); cls = b.match(/align=['"]([^'"]*)['"] ?/); - b = b.replace(cls[0], ''); + if ( cls ) + b = b.replace(cls[0], ''); w = b.match(/width=['"]([0-9]*)['"] ?/); - b = b.replace(w[0], ''); + if ( w ) + b = b.replace(w[0], ''); c = trim(c); img = c.match(/((?:]+>)?]+>(?:<\/a>)?)([\s\S]*)/i);