From 32bd9e6ac7f56d61b6f88fa9635722ec99f05349 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 6 Aug 2004 01:28:51 +0000 Subject: [PATCH] In sanitize_title(), strip_tags() before sanitizing, not after. In post.php, if post name is empty, pass the post title to the sanitizer. git-svn-id: https://develop.svn.wordpress.org/trunk@1512 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/post.php | 6 +++++- wp-includes/functions-formatting.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-admin/post.php b/wp-admin/post.php index 0adb80c917..1faae40438 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -302,7 +302,11 @@ case 'editpost': if (empty($ping_status)) $ping_status = 'closed'; //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status'); $post_password = $_POST['post_password']; - $post_name = sanitize_title($_POST['post_name'], $post_ID); + $post_name = $_POST['post_name']; + if (empty($post_name)) { + $post_name = $post_title; + } + $post_name = sanitize_title($post_name, $post_ID); if (empty($post_name)) $post_name = sanitize_title($post_title); $trackback = $_POST['trackback_url']; // Format trackbacks diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index f3badba605..1b8d293805 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -120,8 +120,9 @@ function remove_accents($string) { } function sanitize_title($title, $fallback_title = '') { - $title = apply_filters('sanitize_title', $title); $title = strip_tags($title); + $title = apply_filters('sanitize_title', $title); + if (empty($title)) { $title = $fallback_title; }